cntrparam controls the generation of contours and their smoothness for a contour plot. contour displays current settings of cntrparam as well as contour.
Syntax:
set cntrparam { { linear | cubicspline | bspline | points <n> | order <n> | levels { auto {<n>} | <n> | discrete <z1> {,<z2>{,<z3>...}} | incremental <start>, <incr> {,<end>} } } } show contour
This command has two functions. First, it sets the values of z for which contour points are to be determined (by linear interpolation between data points or function isosamples.) Second, it controls the way contours are drawn between the points determined to be of equal z. <n> should be an integral constant expression and <z1>, <z2> ... any constant expressions. The parameters are:
`linear`, `cubicspline`, `bspline`—Controls type of approximation or interpolation. If `linear`, then straight line segments connect points of equal z magnitude. If `cubicspline`, then piecewise-linear contours are interpolated between the same equal z points to form somewhat smoother contours, but which may undulate. If `bspline`, a guaranteed-smoother curve is drawn, which only approximates the position of the points of equal-z.
`points`—Eventually all drawings are done with piecewise-linear strokes. This number controls the number of line segments used to approximate the `bspline` or `cubicspline` curve. Number of cubicspline or bspline segments (strokes) = `points` * number of linear segments.
`order`—Order of the bspline approximation to be used. The bigger this order is, the smoother the resulting contour. (Of course, higher order bspline curves will move further away from the original piecewise linear data.) This option is relevant for `bspline` mode only. Allowed values are integers in the range from 2 (linear) to 10.
`levels`— Selection of contour levels, controlled by `auto` (default), `discrete`, `incremental`, and <n>, number of contour levels.
For `auto`, <n> specifies a nominal number of levels; the actual number will be adjusted to give simple labels. If the surface is bounded by zmin and zmax, contours will be generated at integer multiples of dz between zmin and zmax, where dz is 1, 2, or 5 times some power of ten (like the step between two tic marks).
For `levels discrete`, contours will be generated at z = <z1>, <z2> ... as specified; the number of discrete levels sets the number of contour levels. In `discrete` mode, any `set cntrparam levels <n>` are ignored.
For `incremental`, contours are generated at values of z beginning at <start> and increasing by <increment>, until the number of contours is reached. <end> is used to determine the number of contour levels, which will be changed by any subsequent `set cntrparam levels <n>`. If the z axis is logarithmic, <increment> will be interpreted as a factor, just like in ztics.
If the command cntrparam is given without any arguments specified, the defaults are used: linear, 5 points, order 4, 5 auto levels.
Examples:
set cntrparam bspline set cntrparam points 7 set cntrparam order 10
To select levels automatically, 5 if the level increment criteria are met:
set cntrparam levels auto 5
To specify discrete levels at .1, .37, and .9:
set cntrparam levels discrete .1,1/exp(1),.9
To specify levels from 0 to 4 with increment 1:
set cntrparam levels incremental 0,1,4
To set the number of levels to 10 (changing an incremental end or possibly the number of auto levels):
set cntrparam levels 10
To set the start and increment while retaining the number of levels:
set cntrparam levels incremental 100,50
See also contour for control of where the contours are drawn, and clabel for control of the format of the contour labels and linetypes.
See also contours demo (contours.dem) and contours with user defined levels demo (discrete.dem).