set terminal pdf enhanced fontscale 0.75 size 6.0in, 6.0in outputfile = filename.'_hist.pdf' print outputfile set output outputfile # inputs required: filename = (phase space file), events = 'number of events in histogram' reset Y_MIN=0 nturns = 100 n=100 #number of intervals scale=events/n max=50.#max value min=-50. #min value width=(max-min)/n #interval width #function used to map a value to the intervals hist(x,width)=width*floor(x/width)+width/2.0 set xrange [min:max] set xtics min,(max-min)/10,max set boxwidth width*0.9 set style fill solid 0.5 #fillstyle set tics out nomirror set title filename.': kick = '.kick.'G' noenhanced set timestamp offset graph 1.08,0.7 rotate font 'Verdana,6' set label 'plotting_scripts/hist_any_phase_space_file_v2.gnu' at graph 1.02,0.02 rotate left font 'Verdana,6' noenhance set xlabel "x [mm]" stats filename u 4 set label sprintf("%i",STATS_records).' records' at graph 0.1,1.02 leg = ' = '.sprintf("%.1f",STATS_mean*1000).' mm' plot filename u (hist(($4)*1.e3,width)):(1.0) smooth freq w boxes lc rgb"green" t leg print GPVAL_Y_MAX, scale Y_MAX = (0+floor(GPVAL_Y_MAX/scale)) * scale set ytics 0,(Y_MAX-Y_MIN)/5.,GPVAL_Y_MAX #replot max=50. #max value min=-50. #min value width=(max-min)/n #interval width set xrange [min:max] set xtics min,(max-min)/10,max set boxwidth width*0.9 set style fill solid 0.5 #fillstyle set tics out nomirror set xlabel "y [mm]" stats filename u 6 leg = ' = '.sprintf("%.1f",STATS_mean*1000).' mm' plot filename u (hist(($6)*1.e3,width)):(1.0) smooth freq w boxes lc rgb"green" t leg scale=5 print GPVAL_Y_MAX, scale Y_MAX = (0+floor(GPVAL_Y_MAX/scale)) * scale Y_MAX = int(GPVAL_Y_MAX/scale)*scale + scale print Y_MAX, GPVAL_Y_MAX, scale set ytics 0,(Y_MAX-Y_MIN)/scale #replot max=0.5#max value min=-0.5#min value width=(max-min)/n #interval width set xrange [min:max] set xtics min,(max-min)/10,max set boxwidth width*0.9 set style fill solid 0.5 #fillstyle set tics out nomirror set xlabel "dp/p [%]" stats filename u 9 leg = ' = '.sprintf("%.4f",STATS_mean*100).'%' plot filename u (hist(($9)*1.e2,width)):(1.0) smooth freq w boxes lc rgb"green" t leg Y_MAX = (0+floor(GPVAL_Y_MAX/5)) * 5 set ytics Y_MIN,(Y_MAX-Y_MIN)/5.,GPVAL_Y_MAX #replot max=100. #max value min=-100. #min value width=(max-min)/n #interval width set xrange [min:max] set xtics min,(max-min)/10,max set xtics min,40 set boxwidth width*0.9 set style fill solid 0.5 #fillstyle set tics out nomirror unset label 1 set xlabel "t [ns]" stats filename u 10 leg = ' = '.sprintf("%.1f",STATS_mean*1.e9).' ns' plot filename u (hist(($10-STATS_mean)*1.e9,width)):(1.0) smooth freq w boxes lc rgb "green" t leg xdif = (GPVAL_DATA_X_MAX-GPVAL_DATA_X_MIN)/5 Y_MAX = (0+floor(GPVAL_Y_MAX/10)) * 10 incr = Y_MAX/4 set ytics 0,incr #replot #