# use this to histogram a column - especially distribution of scattering angles #max=0.01 #max value #min=-0.01 #min value set term pdf fontscale 0.75 size 4in,4in set output 'fiberScatter.pdf' set timestamp offset graph 1.1,0.7 rotate font 'Verdana,6' set label 'mytest/fiber_scattering/hist.gnu' at graph 1.02,0.02 rotate left font 'Verdana,8' noenhance 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 yrange [0:] #set noytics #to put an empty boundary around the #data inside an autoscaled graph. #set offset graph 0.05,0.05,0.05,0.0 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 "Energy Loss [MeV]" set ylabel "Frequency" #set ytics 50 #count and plot set title 'Energy loss '.filename plot 'fort.111' u (hist(($7*3.1*1000),width)):(1.0) smooth freq w boxes lc rgb"green" not #,filename u (hist(($11)*1.e3,width)):(1.0) smooth freq w boxes lc rgb"blue" t "py[mrad]" set xlabel 'Scatter [mrad]' set title 'Scattering Angle '.filename width=(max1-min1)/n1 #interval width set boxwidth width*0.9 set xrange [min1:max1] set xtics min1,(max1-min1)/10,max1 plot 'fort.111' u (hist( (($3)**2+($5)**2)**.5*1000,width)):(1.0) smooth freq w boxes lc rgb"green" not print 'fiberScatter.pdf'