set term pdf fontscale 0.75 size 6in,4in outfile = 'pitch.pdf' set output outfile set timestamp offset graph 0.99,0.6 rotate font 'Verdana,6' set label 5 at graph 0.06,0.05 dir noenhance font ',10' set label 3 'plotting_scripts/pitch' at graph 1.02,0.02 rotate left font 'Verdana,6' noenhance # s-px phase space filename = 'pitch_vs_offset.dat' #generated with compile_Time_Dep.f90 set xlabel 'vertical offset [mm]' set ylabel '(1/4)<{/Symbol y}_0^2> [mrad^2]' set y2label 'C_p [ppm]' set yrange [0:] stats filename u ($4):($2*1.e6*$4) total_hits=sprintf("%3.0f",STATS_sum_x) pitch2_avg = sprintf("%3.3f",STATS_sum_y/STATS_sum_x/4) stats filename u ($4):($3*$4) cp_avg = sprintf("%3.3f",STATS_sum_y/STATS_sum_x) set yrange [-1.8:0] set y2range [-1.8:0] set key center Left set label 1 ' Hits = '.total_hits at graph 0.15,1.05 set label 2 '(1/4)<<{/Symbol y}_0^2>> = -'.pitch2_avg.' mrad^2' at graph 0.25,0.2 font ',10' set label 4 ' = -'.cp_avg.' ' at graph 0.25,0.1 font ',10' plot filename u 1:(-$2*1.e6 /4.):(sqrt($4)*($2*1.e6/2.)/$4) w errorbars pt 5 ps 0.5 t '(1/4)<{/Symbol y}_0^2>', '' u 1:(-$3) axes x1y2 pt 5 ps .5 t 'C_p' print 'total hits = ', total_hits print 'average pitch^2 = ',pitch2_avg print outfile