file "Refractive_Error_Distribution.gnuplot.txt":
reset
set terminal svg size 800 800 fixed fname 'Times' fsize 8 rounded dynamic
set output "Refractive_Error_Distribution.svg"
set style function lines
set multiplot layout 2, 2 title "Normal Distribution of Refractive Error of Children aged 3 ... 15\n 1961 Data from [Sorsby et al. 1961], 1997 Data from CLEERE Study [Zadnik et al. 2003]"
set grid
set xtics 1
set ytics 1
set y2tics 1
set xrange [3:15]
set yrange [-5:+5]
set y2range [-5:+5]
set key left bottom
set format y "%+g"
set format y2 ""
set xlabel "Girls (UK 1961) / Age"
set ylabel "Refractive Error RE [dpt]"
#
# The Sorsby dataset provides standard error, not standard deviation. For conversion we need to multiply by sqrt(n)
#
plot "Sorsby 1961-girls.dat" \
u 1:($2-2.58*$3*sqrt($4)):($2+2.58*$3*sqrt($4)) with filledcurve title "RE ± 2.58σ (99% CI)" lc rgb "#F5E3D0", \
"" u 1:($2-2*$3*sqrt($4)):($2+2*$3*sqrt($4)) with filledcurve title "RE ± 2σ (95.45% CI)" lc rgb "#FAB068", \
"" u 1:($2-$3*sqrt($4)):($2+$3*sqrt($4)) with filledcurve title "RE ± 1σ (68.27% CI)" lc rgb "#F04C2B", \
"" u 1:2 with lines notitle lc rgb "#FAB068" lw 2
set xlabel "Boys (UK 1961) / Age"
unset ylabel
set format y ""
set format y2 "%+g"
plot "Sorsby 1961-boys.dat" \
u 1:($2-2.58*$3*sqrt($4)):($2+2.58*$3*sqrt($4)) with filledcurve title "RE ± 2.58σ (99% CI)" lc rgb "#C5E1EF", \
"" u 1:($2-2*$3*sqrt($4)):($2+2*$3*sqrt($4)) with filledcurve title "RE ± 2σ (95.45% CI)" lc rgb "#2B8CBE", \
"" u 1:($2-$3*sqrt($4)):($2+$3*sqrt($4)) with filledcurve title "RE ± 1σ (68.27% CI)" lc rgb "#045A8D", \
"" u 1:2 with lines notitle lc rgb "#2B8CBE" lw 2
set format y "%+g"
set format y2 ""
set xlabel "Girls (US 1997) / Age"
set ylabel "Refractive Error RE [dpt]"
plot "CLEERE-girls.dat" \
u 1:($2-2.58*$3):($2+2.58*$3) with filledcurve title "RE ± 2.58σ (99% CI)" lc rgb "#F5E3D0", \
"" u 1:($2-2*$3):($2+2*$3) with filledcurve title "RE ± 2σ (95.45% CI)" lc rgb "#FAB068", \
"" u 1:($2-$3):($2+$3) with filledcurve title "RE ± 1σ (68.27% CI)" lc rgb "#F04C2B", \
"" u 1:2 with lines notitle lc rgb "#FAB068" lw 2
set xlabel "Boys (US 1997) / Age"
unset ylabel
set format y ""
set format y2 "%+g"
plot "CLEERE-boys.dat" \
u 1:($2-2.58*$3):($2+2.58*$3) with filledcurve title "RE ± 2.58σ (99% CI)" lc rgb "#C5E1EF", \
"" u 1:($2-2*$3):($2+2*$3) with filledcurve title "RE ± 2σ (95.45% CI)" lc rgb "#2B8CBE", \
"" u 1:($2-$3):($2+$3) with filledcurve title "RE ± 1σ (68.27% CI)" lc rgb "#045A8D", \
"" u 1:2 with lines notitle lc rgb "#2B8CBE" lw 2
command to generate SVG: "gnuplot Refractive_Error_Distribution.gnuplot.txt"