Credits Overview Plotting Styles Commands Terminals

smooth

gnuplot includes a few routines for interpolation and other operations applied to data as it is input; these are grouped under the smooth option. More sophisticated data processing may be performed by preprocessing the data externally or by using fit with an appropriate model. See also the discussion of plot filters.

Syntax:

      smooth {unique | frequency | fnormal | cumulative | cnormal
             | csplines | acsplines | mcsplines  bezier | sbezier
             | path {expand <scale>}
             | kdensity {bandwidth} {period}
             | unwrap}

The unique, frequency, fnormal, cumulative and cnormal options sort the data on x and then plot some aspect of the distribution of x values.

The spline and Bezier options determine coefficients describing a continuous curve between the endpoints of the data. This curve is then plotted in the same manner as a function, that is, by finding its value at uniform intervals along the abscissa (see set samples) and connecting these points with straight line segments. If the data set is interrupted by blank lines or undefined values a separate continuous curve is fit for each uninterrupted subset of the data. Adjacent separately fit segments may be separated by a gap or discontinuity.

unwrap manipulates the data to avoid jumps of more than pi by adding or subtracting multiples of 2*pi.

If autoscale is in effect, axis ranges will be computed for the final curve rather than for the original data.

If autoscale is not in effect, and a spline curve is being generated, sampling of the spline fit is done across the intersection of the x range covered by the input data and the fixed abscissa range defined by set xrange.

If too few points are available to apply the requested smoothing operation an error message is produced.

The smooth options have no effect on function plots. Only smooth path is possible in polar coordinate mode.

Smoothing in 3D plots (splot) is currently limited to generating a natural cubic spline to pass through a set of 3D points. In the general case the splines are generated along a trajectory (smooth path). For a 2D projection of 3D data smooth csplines acts as it does in 2D. Either keyword is accepted in an splot command.

     splot $DATA using 1:2:3 smooth path with lines
Subtopics