set terminal postscript eps color enhanced font "Helvetica,16pt" size 9cm,10cm #set terminal pngcairo enhanced font "Helvetica,48pt" size 4000,3000 set output "multiplot_g2precision.eps" set multiplot # common settings set format y "%4g" set format x "%2.0f" set format x2 "%2.0f" set tics scale 1 set tics nomirror set format y2 "%2.1f" set y2r [0.85:1.85] set y2tics 0.5 set ytics 500 set x2r [-600:600] set x2tics 250 set xtics 1 set border linewidth 1 set bars small # top figure set origin -0.02,0.5 set size 1.02,0.5 set xlabel "Time-of-flight {/Symbol t} (ns)" offset 0,0.5 set x2label "Ranging distance (mm)" set ylabel "Two-photoevent coincidences" offset 0,0 set y2label "g^{(2)}({/Symbol t})" rotate by -90 offset -0.5,0 # for fit function N(x)=a+b*((exp(-abs((x-d)/tc)))**2) N2(x)=a2+b2*((exp(-abs((x-d2)/tc2)))**2) # for plotting with reference to fitted timing=zero M(x)=a+b*((exp(-abs((x)/tc)))**2) M2(x)=a2+b2*((exp(-abs((x-(d-d2))/tc2)))**2) a=1000 b=650 tc=1 d=-11.5 a2=1000 b2=650 tc2=1 d2=-11.5 set fit errorvariables set xrange [-19:-1] FIT_LIMIT=1.e-15 FIT_MAXITER=1000 fit N(x) 'precision_g2.txt' using 2:3:(sqrt($3)) via a,b,tc,d fit N2(x) 'precision_g2.txt' using 2:21:(sqrt($21)) via a2,b2,tc2,d2 set x2tics add (150*(d-d2)) set xrange [-4:4] set yrange [0.85*a:1.85*a] #set arrow 1 from 0,1.75*a to 0,1.9*a lw 1 lc rgb 'black' filled #set arrow 2 from (d-d2),1.75*a to (d-d2),1.9*a lw 1 lc rgb 'red' filled # set label 1 "g^{(2)}(0)=1.27" at 0,600 # set label 2 "delay = 0 +/- 0.6 mm" at 1,15000 set samples 10000 plot 'precision_g2.txt' using (d-$2):3:(sqrt($3)) w yerrorbars notitle lw 2 ps 0 lc rgb "black",\ M(x) w l lw 2 lc rgb "black" notitle,\ 'precision_g2.txt' using (d-$2):21:(sqrt($21)) w yerrorbars notitle lw 2 ps 0 lc rgb "red",\ M2(x) w l lw 2 lc rgb "red" notitle unset x2tics unset x2label # bottom figure set origin 0,0.0 set size 1.0,0.47 set format x "%2.0f" set format y "%2.0f" set format y2 "%2.1f" set yr [0:100] set ytics 25 set y2r [0:0.667] set y2tics 0.2 set xr [0:100] set xtics 25 set tics scale 1 set tics nomirror set border linewidth 1 set bars small set xlabel "Placement (mm)" set ylabel "Ranging distance (mm)" offset -1,0 set y2label "Time-of-flight {/Symbol t} (ns)" rotate by -90 offset -0.5,0 #set label at 30,50 "3{/Symbol s} Confidence" rotate by 16 y(x)=x ymore(x)=x+3.63 yless(x)=x-3.63 set samples 1000 plot 'precision_timeofflight.txt' using 1:6:7 notitle with yerrorbars lw 1 ps 1 pt 4 lc rgb "red", y(x) dt 2 lw 2 lc rgb "black" notitle #, ymore(x) dt 2 lw 2 lc rgb "black" notitle, yless(x) dt 2 lw 2 lc rgb "black" notitle unset multiplot reset