Let's assume a sequence of points. If I would like to plot a smooth curve through these points,
I thought the plot option smooth
would do the job.
From help smooth
:
Syntax:
smooth {unique | frequency | fnormal | cumulative | cnormal | bins | kdensity {bandwidth} | csplines | acsplines | mcsplines | bezier | sbezier | unwrap}
So, Bézier curves will not go through the points, but some of the splines
should.
However, in gnuplot splines
require monotonic x-values. If they are not monotonic, gnuplot will make them monotonic,
with (in this case) undesired results.
How can I draw a smooth curve through the points?
Example:
### smooth curve through points?
reset session
set size ratio -1
$Data <<EOD
0 0
2 3
4 2
9 3
5 7
3 6
4 5
5 5
4 4
1 6
1 4
3 10
EOD
set key out
set ytics 1
plot $Data u 1:2 w lp pt 7 lc "red" dt 3 ti "data", \
'' u 1:2 w l smooth bezier lc "green" ti "bézier", \
'' u 1:2 w l smooth csplines lc "orange" ti "csplines", \
'' u 1:2 w l smooth mcsplines lc "magenta" ti "mcsplines", \
'' u 1:2 w l smooth acsplines lc "yellow" ti "acsplines"
### end of code
Result: (none of the smooth
options will give the desired result)