velocity-xy-dist.gnuplot (3562B)
1 load 'gnuplot/blues.pal' 2 load 'build/gnuplot/direction_rmse.gnuplot' 3 set palette defined (0 '#4040c0', 1 '#c0c0c0', 2 '#c04040') 4 #set palette defined (0 '#c0c0c0', 1 '#c04040') 5 f = 0.90 6 set terminal svg size 450/2*f,450/2*f font 'Free Serif, 10' enhanced round dynamic 7 #set terminal eps size 450/2/72,450/2/72 font 'Free Serif, 10' enhanced round 8 #set terminal png size 450/2,450/2 font 'Free Serif, 10' enhanced 9 set xtics nomirror out offset 0,0.25 10 set ytics nomirror out offset 0.5,0 11 #set border 2+8 12 unset border 13 unset xtics 14 unset ytics 15 #set key top center outside Left reverse 16 unset key 17 18 #set xlabel 'υ_x' 19 #set ylabel 'υ_y' 20 set cbrange [0:*] 21 set lmargin 2 22 set tmargin 3.5 23 set bmargin 1.5 24 set rmargin 6 25 set size square 26 #set lmargin at screen 0.05 27 #set rmargin at screen 0.85 28 #set bmargin at screen 0.1 29 #set tmargin at screen 0.9 30 31 positive(x) = x<0 ? NaN : x 32 negative(x) = x>0 ? NaN : x 33 round(x) = floor(x+0.5) 34 length(x,y) = sqrt(x**2 + y**2) 35 angle(x,y) = atan2(y,x) 36 s = 0.5 37 circle(x,y,z) = length(x,y)>s ? NaN : z 38 #circle(x,y,z) = z 39 max(x,y) = x>y ? x : y 40 41 direction_rmse = direction_rmse_min 42 direction_rmse_timestamp = direction_rmse_min_timestamp 43 direction_rmse_speed = direction_rmse_min_speed 44 direction_rmse_direction = direction_rmse_min_direction 45 if (ARG1 eq 'max') { 46 direction_rmse = direction_rmse_max; 47 direction_rmse_timestamp = direction_rmse_max_timestamp; 48 direction_rmse_speed = direction_rmse_max_speed; 49 direction_rmse_direction = direction_rmse_max_direction; 50 } 51 filename = sprintf('build/direction/%d-hist-xy', direction_rmse_timestamp) 52 filename_tmp = sprintf('%s.tmp', filename) 53 filename_cnt = sprintf('%s.cnt', filename) 54 filename_out = sprintf('build/gnuplot/velocity-xy-dist-%s.svg', ARG1) 55 rmse = direction_rmse 56 speed = direction_rmse_speed 57 print filename 58 59 ## interpolation {{{ 60 ## http://www.gnuplotting.org/circular-heat-map/ 61 #set table filename_tmp 62 #set dgrid3d 100,100 63 set xrange [-1:1] 64 set yrange [-1:1] 65 #splot filename using 1:2:3 66 #unset table 67 ## }}} 68 # 69 ## contours {{{ 70 #set table filename_cnt 71 #set contour base 72 #set cntrparam levels 5 73 #set cntrparam order 8 bspline 74 ##set cntrlabel onecolor format '%8.3g' font ',7' start 25 interval -1 75 #unset surface 76 #set dgrid3d 100,100 77 #splot filename using 1:2:3 with lines 78 #unset table 79 ## }}} 80 set output filename_out 81 set multiplot 82 83 set border lw 1 1+2+4+8 84 unset border 85 set colorbox user origin 0.900,0.1 size 0.03,0.8 86 set cbtics offset -0.5,0 87 set xrange [-1*s:1*s] 88 set yrange [-1*s:1*s] 89 set title offset 0,0.5 90 set title sprintf("%s–%s\nNRMSE = %.0f%%, mean speed = %.1fm/s",\ 91 strftime('%F %H:%M', direction_rmse_timestamp),\ 92 strftime('%H:%M', direction_rmse_timestamp+2*60*60),\ 93 round(rmse*100), speed) 94 #plot filename using 1:2:(positive($3)) with points pt 7 ps 0.25 linecolor palette z 95 plot filename using ($1+0.005):2:(circle($1,$2,$3)) with image 96 #plot filename_cnt using (circle($1,$2,$1)):2 with lines lc '#404040' 97 98 # polar grid {{{ 99 # now plot the polar grid only 100 # https://stackoverflow.com/questions/18792461/gnuplot-2d-polar-plot-with-heatmap-from-3d-dataset-possible 101 r = 3 102 unset contour 103 set border polar lw 4 lc rgb '#404040' back 104 set surface 105 set angles degree 106 set style line 11 lc rgb '#404040' lw 0.5 dashtype 2 107 set grid polar ls 11 nortics back 108 set polar 109 set rrange[0:r] 110 unset raxis 111 set rtics format '' scale 0 112 unset parametric 113 set for [i=0:330:30] label at first (r+0.40)*cos(i), first (r+0.40)*sin(i) center sprintf('%d', i) 114 plot NaN w l 115 unset polar 116 unset grid 117 unset border 118 # }}} 119 #plot filename_tmp using 1:2:(circle($1,$2,$3)) with image 120