GNUPlot Manual
GNUPlot Manual
GNUPlot Manual
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
28 PLOT gnuplot 4.0 41<br />
28.1.4 Smooth<br />
gnuplot includes a few general-purpose routines for interpolation and approximation of data; these<br />
are grouped under the smooth option. More sophisticated data processing may be performed by<br />
preprocessing the data externally or by using fit with an appropriate model.<br />
Syntax:<br />
smooth {unique | frequency | csplines | acsplines | bezier | sbezier}<br />
unique and frequency plot the data after making them monotonic. Each of the other routines uses<br />
the data to determine the coefficients of a continuous curve between the endpoints of the data. This<br />
curve is then plotted in the same manner as a function, that is, by finding its value at uniform intervals<br />
along the abscissa (see set samples (p. 90)) and connecting these points with straight line segments<br />
(if a line style is chosen).<br />
If autoscale is in effect, the ranges will be computed such that the plotted curve lies within the borders<br />
of the graph.<br />
If autoscale is not in effect, and the smooth option is either acspline or cspline, the sampling of the<br />
generated curve is done across the intersection of the x range covered by the input data and the fixed<br />
abscissa range as defined by set xrange.<br />
If too few points are available to allow the selected option to be applied, an error message is produced.<br />
The minimum number is one for unique and frequency, four for acsplines, and three for the others.<br />
The smooth options have no effect on function plots.<br />
28.1.4.1 Acsplines The acsplines option approximates the data with a "natural smoothing spline".<br />
After the data are made monotonic in x (see smooth unique (p. 41)), a curve is piecewise constructed<br />
from segments of cubic polynomials whose coefficients are found by the weighting the data points; the<br />
weights are taken from the third column in the data file. That default can be modified by the third<br />
entry in the using list, e.g.,<br />
plot ’data-file’ using 1:2:(1.0) smooth acsplines<br />
Qualitatively, the absolute magnitude of the weights determines the number of segments used to construct<br />
the curve. If the weights are large, the effect of each datum is large and the curve approaches that<br />
produced by connecting consecutive points with natural cubic splines. If the weights are small, the<br />
curve is composed of fewer segments and thus is smoother; the limiting case is the single segment<br />
produced by a weighted linear least squares fit to all the data. The smoothing weight can be expressed<br />
in terms of errors as a statistical weight for a point divided by a "smoothing factor" for the curve so<br />
that (standard) errors in the file can be used as smoothing weights.<br />
Example:<br />
sw(x,S)=1/(x*x*S)<br />
plot ’data_file’ using 1:2:(sw($3,100)) smooth acsplines<br />
28.1.4.2 Bezier The bezier option approximates the data with a Bezier curve of degree n (the<br />
number of data points) that connects the endpoints.<br />
28.1.4.3 Csplines The csplines option connects consecutive points by natural cubic splines after<br />
rendering the data monotonic (see smooth unique (p. 41)).<br />
28.1.4.4 Sbezier The sbezier option first renders the data monotonic (unique) and then applies<br />
the bezier algorithm.<br />
28.1.4.5 Unique The unique option makes the data monotonic in x; points with the same x-value<br />
are replaced by a single point having the average y-value. The resulting points are then connected by<br />
straight line segments.<br />
demos