#!/usr/local/bin/gnuplot -persist # set terminal pngcairo transparent enhanced fontscale 1.0 size 600, 400 # set output 'piecewise.2.png' set format x "%.1f" set format y "%.1f" set format x2 "%.1f" set format y2 "%.1f" set format z "%.1f" set format cb "%.1f" set format r "%.1f" set key fixed left top vertical Left reverse enhanced autotitle nobox set key invert samplen 4 spacing 1 width 0 height 0 set label 1 "plot norm(x), [0:1] part1(x), [1:4] part2(x)" at 1.00000, 0.620000, 0.00000 left norotate back nopoint set arrow 1 from 1.00000, 0.700000, 0.00000 to 1.00000, 0.900000, 0.00000 nohead back nofilled linewidth 1.000 dashtype solid set style line 1 lt 0 linecolor 0 linewidth 3.000 dashtype solid pointtype 0 pointsize default set style line 2 lt 0 linecolor rgb "red" linewidth 3.000 dashtype solid pointtype 0 pointsize default unset parametric set style data lines set xtics border in scale 1,0.5 nomirror norotate autojustify set title "Piecewise approximation to the\nNormal Cumulative Distribution Function" set xrange [ 0.00000 : 4.00000 ] noreverse nowriteback set x2range [ * : * ] noreverse writeback set yrange [ 0.500000 : 1.10000 ] noreverse nowriteback set y2range [ * : * ] noreverse writeback set zrange [ * : * ] noreverse writeback set cbrange [ * : * ] noreverse writeback set rrange [ * : * ] noreverse writeback set colorbox vertical origin screen 0.9, 0.2 size screen 0.05, 0.6 front noinvert bdefault part1(x) = 0.5 + (9.*x-x**3)/ 24. part2(x) = 1.0 + (x-3.0)**3 / 48. NO_ANIMATION = 1 save_encoding = "utf8" part1 = "part1: for x < 1 norm(x) ≈ ½ + (9x-x^3) / 24" part2 = "part2: for x > 1 norm(x) ≈ 1 + (x-3)^3 / 48" plot norm(x) lt -1, [1:4] part2(x) ls 2 title part2, [0:1] part1(x) ls 1 title part1