# set terminal pngcairo transparent enhanced fontscale 1.0 size 600, 400 # set output 'approximate.1.png' set bar 1.000000 front set style fill solid 0.40 noborder set style circle radius graph 0.02, first 0.00000, 0.00000 set style ellipse size graph 0.05, 0.03, first 0.00000 angle 0 units xy set format y "%.1f" set key inside center top vertical Left reverse enhanced autotitle nobox set style textbox transparent margins 1.0, 1.0 border unset logscale set samples 500, 500 set style data lines set xtics norangelimit set xtics ("-π" -3.14159, "-π/2" -1.57080, 0.00000, "π/2" 1.57080, "π" 3.14159) unset paxis 1 tics unset paxis 2 tics unset paxis 3 tics unset paxis 4 tics unset paxis 5 tics unset paxis 6 tics unset paxis 7 tics set title "Polynomial approximation of sin(x)" set xrange [ -3.20000 : 3.20000 ] noreverse nowriteback set paxis 1 range [ * : * ] noreverse nowriteback set paxis 2 range [ * : * ] noreverse nowriteback set paxis 3 range [ * : * ] noreverse nowriteback set paxis 4 range [ * : * ] noreverse nowriteback set paxis 5 range [ * : * ] noreverse nowriteback set paxis 6 range [ * : * ] noreverse nowriteback set paxis 7 range [ * : * ] noreverse nowriteback set colorbox vertical origin screen 0.9, 0.2, 0 size screen 0.05, 0.6, 0 front noinvert bdefault approx_1(x) = x - x**3/6 approx_2(x) = x - x**3/6 + x**5/120 approx_3(x) = x - x**3/6 + x**5/120 - x**7/5040 GPFUN_approx_1 = "approx_1(x) = x - x**3/6" GPFUN_approx_2 = "approx_2(x) = x - x**3/6 + x**5/120" GPFUN_approx_3 = "approx_3(x) = x - x**3/6 + x**5/120 - x**7/5040" label1 = "x - {x^3}/3!" label2 = "x - {x^3}/3! + {x^5}/5!" label3 = "x - {x^3}/3! + {x^5}/5! - {x^7}/7!" save_encoding = "utf8" x = 3.2 ## Last datafile plotted: "+" plot '+' using 1:(sin($1)):(approx_1($1)) with filledcurve title label1 lt 3, '+' using 1:(sin($1)):(approx_2($1)) with filledcurve title label2 lt 2, '+' using 1:(sin($1)):(approx_3($1)) with filledcurve title label3 lt 1, sin(x) with lines lw 1 lc rgb "black"