Set-show

The set command can be used to set _lots_ of options. No screen is drawn, however, until a plot, splot, or replot command is given.

The show command shows their settings; show all shows all the settings.

Options changed using set can be returned to the default state by giving the corresponding unset command. See also the reset command, which returns all settable parameters to default values.

If a variable contains time/date data, show will display it according to the format currently defined by set timefmt, even if that was not in effect when the variable was initially defined.

The set and unset commands may optionally contain an iteration clause. See plot for.

Angles

By default, gnuplot assumes the independent variable in polar graphs is in units of radians. If set angles degrees is specified before set polar, then the default range is [0:360] and the independent variable has units of degrees. This is particularly useful for plots of data files. The angle setting also applies to 3D mapping as set via the set mapping command.

Syntax:

set angles {degrees | radians}
show angles

The angle specified in set grid polar is also read and displayed in the units specified by set angles.

set angles also affects the arguments of the machine-defined functions sin(x), cos(x) and tan(x), and the outputs of asin(x), acos(x), atan(x), atan2(x), and arg(x). It has no effect on the arguments of hyperbolic functions or Bessel functions. However, the output arguments of inverse hyperbolic functions of complex arguments are affected; if these functions are used, set angles radians must be in effect to maintain consistency between input and output arguments.

x={1.0,0.1}
set angles radians
y=sinh(x)
print y         #prints {1.16933, 0.154051}
print asinh(y)  #prints {1.0, 0.1}

but

set angles degrees
y=sinh(x)
print y         #prints {1.16933, 0.154051}
print asinh(y)  #prints {57.29578, 5.729578}

See also

poldat.dem: polar plot using set angles demo.

Arrow

Arbitrary arrows can be placed on a plot using the set arrow command.

Syntax:

set arrow {<tag>} from <position> to <position>
set arrow {<tag>} from <position> rto <position>
set arrow {<tag>} from <position> length <coord> angle <ang>
set arrow <tag> arrowstyle | as <arrow_style>
set arrow <tag> {nohead | head | backhead | heads}
                {size <headlength>,<headangle>{,<backangle>}}
                {filled | empty | nofilled | noborder}
                {front | back}
                {linestyle <line_style>}
                {linetype <line_type>} {linewidth <line_width>}
unset arrow {<tag>}
show arrow {<tag>}

<tag> is an integer that identifies the arrow. If no tag is given, the lowest unused tag value is assigned automatically. The tag can be used to delete or change a specific arrow. To change any attribute of an existing arrow, use the set arrow command with the appropriate tag and specify the parts of the arrow to be changed.

The position of the first end point of the arrow is always specified by "from". The other end point can be specified using any of three different mechanisms. The <position>s are specified by either x,y or x,y,z, and may be preceded by first, second, graph, screen, or character to select the coordinate system. Unspecified coordinates default to 0. See coordinates for details. A coordinate system specifier does not carry over from the first endpoint description the second.

1) "to <position>" specifies the absolute coordinates of the other end.

2) "rto <position>" specifies an offset to the "from" position. For linear axes, graph and screen coordinates, the distance between the start and the end point corresponds to the given relative coordinate. For logarithmic axes, the relative given coordinate corresponds to the factor of the coordinate between start and end point. Thus, a negative relative value or zero are not allowed for logarithmic axes.

3) "length <coordinate> angle <angle>" specifies the orientation of the arrow in the plane of the graph. Again any of the coordinate systems can be used to specify the length. The angle is always in degrees.

Other characteristics of the arrow can either be specified as a pre-defined arrow style or by providing them in set arrow command. For a detailed explanation of arrow characteristics, see arrowstyle.

Examples:

To set an arrow pointing from the origin to (1,2) with user-defined linestyle 5, use:

set arrow to 1,2 ls 5

To set an arrow from bottom left of plotting area to (-5,5,3), and tag the arrow number 3, use:

set arrow 3 from graph 0,0 to -5,5,3

To change the preceding arrow to end at 1,1,1, without an arrow head and double its width, use:

set arrow 3 to 1,1,1 nohead lw 2

To draw a vertical line from the bottom to the top of the graph at x=3, use:

set arrow from 3, graph 0 to 3, graph 1 nohead

To draw a vertical arrow with T-shape ends, use:

set arrow 3 from 0,-5 to 0,5 heads size screen 0.1,90

To draw an arrow relatively to the start point, where the relative distances are given in graph coordinates, use:

set arrow from 0,-5 rto graph 0.1,0.1

To draw an arrow with relative end point in logarithmic x axis, use:

set logscale x
set arrow from 100,-5 rto 10,10

This draws an arrow from 100,-5 to 1000,5. For the logarithmic x axis, the relative coordinate 10 means "factor 10" while for the linear y axis, the relative coordinate 10 means "difference 10".

To delete arrow number 2, use:

unset arrow 2

To delete all arrows, use:

unset arrow

To show all arrows (in tag order), use:

show arrow

arrows demos.

Autoscale

Autoscaling may be set individually on the x, y or z axis or globally on all axes. The default is to autoscale all axes. If you want to autoscale based on a subset of the plots in the figure, you can mark the other ones with the flag noautoscale. See datafile.

Syntax:

set autoscale {<axes>{|min|max|fixmin|fixmax|fix} | fix | keepfix}
set autoscale noextend
unset autoscale {<axes>}
show autoscale

where <axes> is either x, y, z, cb, x2, y2 or xy. A keyword with min or max appended (this cannot be done with xy) tells gnuplot to autoscale just the minimum or maximum of that axis. If no keyword is given, all axes are autoscaled.

By default autoscaling sets the axis range limits to the nearest tic label position that includes all the plot data. Keywords fixmin, fixmax, fix or noextend tell gnuplot to disable extension of the axis range to the next tic mark position. In this case the axis range limit exactly matches the coordinate of the most extreme data point. set autoscale noextend is a synonym for set autoscale fix. Range extension for a single axis can be disabled by appending the noextend keyword to the corresponding range command, e.g.

set yrange [0:*] noextend

set autoscale keepfix autoscales all axes while leaving the fix settings unchanged.

When autoscaling, the axis range is automatically computed and the dependent axis (y for a plot and z for splot) is scaled to include the range of the function or data being plotted.

If autoscaling of the dependent axis (y or z) is not set, the current y or z range is used.

Autoscaling the independent variables (x for plot and x,y for splot) is a request to set the domain to match any data file being plotted. If there are no data files, autoscaling an independent variable has no effect. In other words, in the absence of a data file, functions alone do not affect the x range (or the y range if plotting z = f(x,y)).

Please see set xrange for additional information about ranges.

The behavior of autoscaling remains consistent in parametric mode, (see set parametric). However, there are more dependent variables and hence more control over x, y, and z axis scales. In parametric mode, the independent or dummy variable is t for plots and u,v for splots. autoscale in parametric mode, then, controls all ranges (t, u, v, x, y, and z) and allows x, y, and z to be fully autoscaled.

Autoscaling works the same way for polar mode as it does for parametric mode for plot, with the extension that in polar mode set dummy can be used to change the independent variable from t (see set dummy).

When tics are displayed on second axes but no plot has been specified for those axes, x2range and y2range are inherited from xrange and yrange. This is done _before_ applying offsets or autoextending the ranges to a whole number of tics, which can cause unexpected results. To prevent this you can explicitly link the secondary axis range to the primary axis range. See set link.

Examples:

This sets autoscaling of the y axis (other axes are not affected):

set autoscale y

This sets autoscaling only for the minimum of the y axis (the maximum of the y axis and the other axes are not affected):

set autoscale ymin

This disables extension of the x2 axis tics to the next tic mark, thus keeping the exact range as found in the plotted data and functions:

set autoscale x2fixmin
set autoscale x2fixmax

This sets autoscaling of the x and y axes:

set autoscale xy

This sets autoscaling of the x, y, z, x2 and y2 axes:

set autoscale

This disables autoscaling of the x, y, z, x2 and y2 axes:

unset autoscale

This disables autoscaling of the z axis only:

unset autoscale z

Parametric mode

When in parametric mode (set parametric), the xrange is as fully scalable as the y range. In other words, in parametric mode the x axis can be automatically scaled to fit the range of the parametric function that is being plotted. Of course, the y axis can also be automatically scaled just as in the non-parametric case. If autoscaling on the x axis is not set, the current x range is used.

Data files are plotted the same in parametric and non-parametric mode. However, there is a difference in mixed function and data plots: in non-parametric mode with autoscaled x, the x range of the datafile controls the x range of the functions; in parametric mode it has no influence.

For completeness a last command set autoscale t is accepted. However, the effect of this "scaling" is very minor. When gnuplot determines that the t range would be empty, it makes a small adjustment if autoscaling is true. Otherwise, gnuplot gives an error. Such behavior may, in fact, not be very useful and the command set autoscale t is certainly questionable.

splot extends the above ideas as you would expect. If autoscaling is set, then x, y, and z ranges are computed and each axis scaled to fit the resulting data.

Polar mode

When in polar mode (set polar), the xrange and the yrange may be left in autoscale mode. If set rrange is used to limit the extent of the polar axis, then xrange and yrange will adjust to match this automatically. However, explicit xrange and yrange commands can later be used to make further adjustments. See set rrange. The trange may also be autoscaled. Note that if the trange is contained within one quadrant, autoscaling will produce a polar plot of only that single quadrant.

Explicitly setting one or two ranges but not others may lead to unexpected results. See also

polar demos.

Bars

The set bars command controls the tics at the ends of error bars, and also at the end of the whiskers belonging to a boxplot.

Syntax:

set bars {small | large | fullwidth | <size>} {front | back}
unset bars
show bars

small is a synonym for 0.0, and large for 1.0. The default is 1.0 if no size is given.

The keyword fullwidth is relevant only to boxplots and to histograms with errorbars. It sets the width of the errorbar ends to be the same as the width of the associated box. It does not change the width of the box itself.

The front and back keywords are relevant only to errorbars attached to filled rectangles (boxes, candlesticks, histograms).

Bind

Show the current state of all hotkey bindings. See bind.

Bmargin

The command set bmargin sets the size of the bottom margin. Please see set margin for details.

Border

The set border and unset border commands control the display of the graph borders for the plot and splot commands. Note that the borders do not necessarily coincide with the axes; with plot they often do, but with splot they usually do not.

Syntax:

set border {<integer>} {front | back} {linewidth | lw <line_width>}
           {{linestyle | ls <line_style>} | {linetype | lt <line_type>}}
unset border
show border

With a splot displayed in an arbitrary orientation, like set view 56,103, the four corners of the x-y plane can be referred to as "front", "back", "left" and "right". A similar set of four corners exist for the top surface, of course. Thus the border connecting, say, the back and right corners of the x-y plane is the "bottom right back" border, and the border connecting the top and bottom front corners is the "front vertical". (This nomenclature is defined solely to allow the reader to figure out the table that follows.)

The borders are encoded in a 12-bit integer: the four low bits control the border for plot and the sides of the base for splot; the next four bits control the verticals in splot; the four high bits control the edges on top of an splot. The border settings is thus the sum of the appropriate entries from the following table:

Bit plot splot
1 bottom bottom left front
2 left bottom left back
4 top bottom right front
8 right bottom right back
16 no effect left vertical
32 no effect back vertical
64 no effect right vertical
128 no effect front vertical
256 no effect top left back
512 no effect top right back
1024 no effect top left front
2048 no effect top right front

The default setting is 31, which is all four sides for plot, and base and z axis for splot.

In 2D plots the border is normally drawn on top of all plots elements (front). If you want the border to be drawn behind the plot elements, use set border back.

Using the optional <line_style>, <line_type> and <line_width> specifiers, the way the border lines are drawn can be influenced (limited by what the current terminal driver supports).

For plot, tics may be drawn on edges other than bottom and left by enabling the second axes -- see set xtics for details.

If a splot draws only on the base, as is the case with "unset surface; set contour base", then the verticals and the top are not drawn even if they are specified.

The set grid options 'back', 'front' and 'layerdefault' also control the order in which the border lines are drawn with respect to the output of the plotted data.

Examples:

Draw default borders:

set border

Draw only the left and bottom (plot) or both front and back bottom left (splot) borders:

set border 3

Draw a complete box around a splot:

set border 4095

Draw a topless box around a splot, omitting the front vertical:

set border 127+256+512 # or set border 1023-128

Draw only the top and right borders for a plot and label them as axes:

unset xtics; unset ytics; set x2tics; set y2tics; set border 12

Boxwidth

The set boxwidth command is used to set the default width of boxes in the boxes, boxerrorbars, boxplot, candlesticks and histograms styles.

Syntax:

set boxwidth {<width>} {absolute|relative}
show boxwidth

By default, adjacent boxes are extended in width until they touch each other. A different default width may be specified using the set boxwidth command. Relative widths are interpreted as being a fraction of this default width.

An explicit value for the boxwidth is interpreted as being a number of units along the current x axis (absolute) unless the modifier relative is given. If the x axis is a log-scale (see set log) then the value of boxwidth is truly "absolute" only at x=1; this physical width is maintained everywhere along the axis (i.e. the boxes do not become narrower the value of x increases). If the range spanned by a log scale x axis is far from x=1, some experimentation may be required to find a useful value of boxwidth.

The default is superseded by explicit width information taken from an extra data column in styles boxes or boxerrorbars. In a four-column data set, the fourth column will be interpreted as the box width unless the width is set to -2.0, in which case the width will be calculated automatically. See style boxes and style boxerrorbars for more details.

To set the box width to automatic use the command

set boxwidth

or, for four-column data,

set boxwidth -2

The same effect can be achieved with the using keyword in plot:

plot 'file' using 1:2:3:4:(-2)

To set the box width to half of the automatic size use

set boxwidth 0.5 relative

To set the box width to an absolute value of 2 use

set boxwidth 2 absolute

Colorsequence

Syntax:

set colorsequence {default|classic|podo}

set colorsequence default selects a terminal-independent repeating sequence of eight colors. See set linetype, colors.

set colorsequence classic lets each separate terminal type provide its own sequence of line colors. The number provided varies from 4 to more than 100, but most start with red/green/blue/magenta/cyan/yellow. This was the default behaviour of earlier gnuplot versions.

set colorsequence podo selects eight colors drawn from a set recommended by Wong (2011) [Nature Methods 8:441] as being easily distinguished by color-blind viewers with either protanopia or deuteranopia.

In each case you can further customize the length of the sequence and the colors used. See set linetype, colors.

Clabel

This command is obsolete. Use set cntrlabel instead. unset clabel is replaced by set cntrlabel onecolor. set clabel "format" is replaced by set cntrlabel format "format".

Clip

gnuplot can clip data points and lines that are near the boundaries of a graph.

Syntax:

set clip <clip-type>
unset clip <clip-type>
show clip

Three clip types for points and lines are supported by gnuplot: points, one, and two. One, two, or all three clip types may be active for a single graph. Note that clipping of color filled quadrangles drawn by pm3d maps and surfaces is not controlled by this command, but by set pm3d clip1in and set pm3d clip4in.

The points clip type forces gnuplot to clip (actually, not plot at all) data points that fall within but too close to the boundaries. This is done so that large symbols used for points will not extend outside the boundary lines. Without clipping points near the boundaries, the plot may look bad. Adjusting the x and y ranges may give similar results.

Setting the one clip type causes gnuplot to draw a line segment which has only one of its two endpoints within the graph. Only the in-range portion of the line is drawn. The alternative is to not draw any portion of the line segment.

Some lines may have both endpoints out of range, but pass through the graph. Setting the two clip-type allows the visible portion of these lines to be drawn.

In no case is a line drawn outside the graph.

The defaults are noclip points, clip one, and noclip two.

To check the state of all forms of clipping, use

show clip

For backward compatibility with older versions, the following forms are also permitted:

set clip
unset clip

set clip is synonymous with set clip points; unset clip turns off all three types of clipping.

Cntrlabel

Syntax:

set cntrlabel {format "format"} {font "font"}
set cntrlabel {start <int>} {interval <int>}
set contrlabel onecolor

set cntrlabel controls the labeling of contours, either in the key (default) or on the plot itself in the case of splot ... with labels. In the latter case labels are placed along each contour line according to the "pointinterval" property of the label descriptor. By default a label is placed on the 5th line segment making up the contour line and repeated every 20th segment. These defaults are equivalent to

set cntrlabel start 5 interval 20

They can be changed either via the set cntrlabel command or by specifying the interval in the splot command itself

set contours; splot $FOO with labels point pointinterval -1

Setting the interval to a negative value means that the label appear only once per contour line. However if set samples or set isosamples is large then many contour lines may be created, each with a single label.

A contour label is placed in the plot key for each linetype used. By default each contour level is given its own linetype, so a separate label appears for each. The command set cntrlabel onecolor causes all contours to be drawn using the same linetype, so only one label appears in the plot key. This command replaces an older command unset clabel.

Cntrparam

set cntrparam controls the generation of contours and their smoothness for a contour plot. show 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 set ztics.

If the command set 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 set contour for control of where the contours are drawn, and set cntrlabel 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).

Color box

The color scheme, i.e. the gradient of the smooth color with min_z and max_z values of pm3d's palette, is drawn in a color box unless unset colorbox.

set colorbox
set colorbox {
           { vertical | horizontal }
           { default | user }
           { origin x, y }
           { size x, y }
           { front | back }
           { noborder | bdefault | border [line style] }
         }
show colorbox
unset colorbox

Color box position can be default or user. If the latter is specified the values as given with the origin and size subcommands are used. The box can be drawn after (front) or before (back) the graph or the surface.

The orientation of the color gradient can be switched by options vertical and horizontal.

origin x, y and size x, y are used only in combination with the user option. The x and y values are interpreted as screen coordinates by default, and this is the only legal option for 3D plots. 2D plots, including splot with set view map, allow any coordinate system to be specified. Try for example:

set colorbox horiz user origin .1,.02 size .8,.04

which will draw a horizontal gradient somewhere at the bottom of the graph.

border turns the border on (this is the default). noborder turns the border off. If an positive integer argument is given after border, it is used as a line style tag which is used for drawing the border, e.g.:

set style line 2604 linetype -1 linewidth .4
set colorbox border 2604

will use line style 2604, a thin line with the default border color (-1) for drawing the border. bdefault (which is the default) will use the default border line style for drawing the border of the color box.

The axis of the color box is called cb and it is controlled by means of the usual axes commands, i.e. set/unset/show with cbrange, [m]cbtics, format cb, grid [m]cb, cblabel, and perhaps even cbdata, [no]cbdtics, [no]cbmtics.

set colorbox without any parameter switches the position to default. unset colorbox resets the default parameters for the colorbox and switches the colorbox off.

See also help for set pm3d, set palette, x11 pm3d, and set style line.

Colornames

Gnuplot knows a limited number of color names. You can use these to define the color range spanned by a pm3d palette, or to assign a terminal-independent color to a particular linetype or linestyle. To see the list of known color names, use the command show colornames. Example:

set style line 1 linecolor rgb "sea-green"

Contour

set contour enables contour drawing for surfaces. This option is available for splot only. It requires grid data, see grid_data for more details. If contours are desired from non-grid data, set dgrid3d can be used to create an appropriate grid.

Syntax:

set contour {base | surface | both}
unset contour
show contour

The three options specify where to draw the contours: base draws the contours on the grid base where the x/ytics are placed, surface draws the contours on the surfaces themselves, and both draws the contours on both the base and the surface. If no option is provided, the default is base.

See also set cntrparam for the parameters that affect the drawing of contours, and set cntrlabel for control of labeling of the contours.

The surface can be switched off (see unset surface), giving a contour-only graph. Though it is possible to use set size to enlarge the plot to fill the screen, more control over the output format can be obtained by writing the contour information to a datablock, and rereading it as a 2D datafile plot:

unset surface
set contour
set cntrparam ...
set table $datablock
splot ...
unset table
# contour info now in $datablock
set term <whatever>
plot $datablock

In order to draw contours, the data should be organized as "grid data". In such a file all the points for a single y-isoline are listed, then all the points for the next y-isoline, and so on. A single blank line (a line containing no characters other than blank spaces and a carriage return and/or a line feed) separates one y-isoline from the next. See also splot datafile.

See also

contours demo (contours.dem)

and

contours with user defined levels demo (discrete.dem).

Dashtype

The set dashtype command allows you to define a dash pattern that can then be referred to by its index. This is purely a convenience, as anywhere that would accept the dashtype by its numerical index would also accept an explicit dash pattern. Example:

set dashtype 5 (2,4,2,6)   # define or redefine dashtype number 5
plot f1(x) dt 5            # plot using the new dashtype
plot f1(x) dt (2,4,2,6)    # exactly the same plot as above
set linetype 5 dt 5        # always use this dash pattern with linetype 5
set dashtype 66 "..-"      # define a new dashtype using a string

See also dashtype.

Data style

This form of the command is deprecated. Please see set style data.

Datafile

The set datafile command options control interpretation of fields read from input data files by the plot, splot, and fit commands. Six such options are currently implemented.

Set datafile fortran

The set datafile fortran command enables a special check for values in the input file expressed as Fortran D or Q constants. This extra check slows down the input process, and should only be selected if you do in fact have datafiles containing Fortran D or Q constants. The option can be disabled again using unset datafile fortran.

Set datafile nofpe_trap

The set datafile nofpe_trap command tells gnuplot not to re-initialize a floating point exception handler before every expression evaluation used while reading data from an input file. This can significantly speed data input from very large files at the risk of program termination if a floating-point exception is generated.

Set datafile missing

The set datafile missing command tells gnuplot there is a special string used in input data files to denote a missing data entry. There is no default character for missing, but in many cases any non-parseable string of characters found where a numerical value is expected will cause the line to be treated as missing data. There is a distinction between missing data and invalid data (e.g. "NaN", 1/0.). Invalid data causes a gap in the line drawn through the points; missing data does not.

Syntax:

set datafile missing "<string>"
show datafile missing
unset datafile

Note: The treatment of certain cases has changed in this version of gnuplot. The example below shows the difference.

Example:

set style data linespoints
plot '-' title "(a)"
   1 10
   2 20
   3 ?
   4 40
   5 50
   e
set datafile missing "?"
plot '-' title "(b)"
   1 10
   2 20
   3 ?
   4 40
   5 50
   e
plot '-' using 1:2 title "(c)"
   1 10
   2 20
   3 NaN
   4 40
   5 50
   e
plot '-' using 1:($2) title "(d)"
   1 10
   2 20
   3 NaN
   4 40
   5 50
   e

Plot (a) differs because the third line contains only one valid number. Old gnuplot versions switched to a single-datum-on-a-line convention that the line number is "x" and the datum is "y", erroneously placing the point at(2,3).

Both the old and new gnuplot versions handle the same data correctly if the '?' character is designated as a marker for missing data (b).

Old gnuplot versions handled NaN differently depending of the form of the using clause, as shown in plots (c) and (d). Gnuplot now handles NaN the same whether the input column was specified as N or ($N). See also the

imageNaN demo.

Set datafile separator

The command set datafile separator tells gnuplot that data fields in subsequent input files are separated by a specific character rather than by whitespace. The most common use is to read in csv (comma-separated value) files written by spreadsheet or database programs. By default data fields are separated by whitespace.

Syntax:

set datafile separator {whitespace | tab | comma | "<chars>"}

Examples:

# Input file contains tab-separated fields
set datafile separator "\t"
# Input file contains comma-separated values fields
set datafile separator comma
# Input file contains fields separated by either * or |
set datafile separator "*|"

Set datafile commentschars

The set datafile commentschars tells gnuplot what characters are used in a data file to begin comment lines. If the first non-blank character on a line is one of the specified characters then the rest of the input line is ignored. Default value of the string is "#!" on VMS and "#" otherwise.

Syntax:

set datafile commentschars {"<string>"}
show datafile commentschars
unset commentschars

Then, the following line in a data file is completely ignored

# 1 2 3 4

but the following

1 # 3 4

produces a rather unexpected plot unless

set datafile missing '#'

is specified as well.

Example:

set datafile commentschars "#!%"

Set datafile binary

The set datafile binary command is used to set the defaults when reading binary data files. The syntax matches precisely that used for commands plot and splot. See binary matrix and binary general for details about the keywords that can be present in <binary list>.

Syntax:

set datafile binary <binary list>
show datafile binary
show datafile
unset datafile

Examples:

set datafile binary filetype=auto
set datafile binary array=(512,512) format="%uchar"
show datafile binary   # list current settings

Decimalsign

The set decimalsign command selects a decimal sign for numbers printed into tic labels or set label strings.

Syntax:

set decimalsign {<value> | locale {"<locale>"}}
unset decimalsign
show decimalsign

The argument <value> is a string to be used in place of the usual decimal point. Typical choices include the period, '.', and the comma, ',', but others may be useful, too. If you omit the <value> argument, the decimal separator is not modified from the usual default, which is a period. Unsetting decimalsign has the same effect as omitting <value>.

Example:

Correct typesetting in most European countries requires:

set decimalsign ','

Please note: If you set an explicit string, this affects only numbers that are printed using gnuplot's gprintf() formatting routine, include axis tics. It does not affect the format expected for input data, and it does not affect numbers printed with the sprintf() formatting routine. To change the behavior of both input and output formatting, instead use the form

set decimalsign locale

This instructs the program to use both input and output formats in accordance with the current setting of the LC_ALL, LC_NUMERIC, or LANG environmental variables.

set decimalsign locale "foo"

This instructs the program to format all input and output in accordance with locale "foo", which must be installed. If locale "foo" is not found then an error message is printed and the decimal sign setting is unchanged. On linux systems you can get a list of the locales installed on your machine by typing "locale -a". A typical linux locale string is of the form "sl_SI.UTF-8". A typical Windows locale string is of the form "Slovenian_Slovenia.1250" or "slovenian". Please note that interpretation of the locale settings is done by the C library at runtime. Older C libraries may offer only partial support for locale settings such as the thousands grouping separator character.

set decimalsign locale; set decimalsign "."

This sets all input and output to use whatever decimal sign is correct for the current locale, but over-rides this with an explicit '.' in numbers formatted using gnuplot's internal gprintf() function.

Dgrid3d

The set dgrid3d command enables, and can set parameters for, non-grid to grid data mapping. See splot grid_data for more details about the grid data structure.

Syntax:

set dgrid3d {<rows>} {,{<cols>}}
            { splines |
              qnorm {<norm>} |
              (gauss | cauchy | exp | box | hann) 
                {kdensity} {<dx>} {,<dy>} }
unset dgrid3d
show dgrid3d

By default dgrid3d is disabled. When enabled, 3D data read from a file are always treated as a scattered data set. A grid with dimensions derived from a bounding box of the scattered data and size as specified by the row/col_size parameters is created for plotting and contouring. The grid is equally spaced in x (rows) and in y (columns); the z values are computed as weighted averages or spline interpolations of the scattered points' z values. In other words, a regularly spaced grid is created and the a smooth approximation to the raw data is evaluated for all grid points. This approximation is plotted in place of the raw data.

The number of columns defaults to the number of rows, which defaults to 10.

Several algorithms are available to calculate the approximation from the raw data. Some of these algorithms can take additional parameters. These interpolations are such the closer the data point is to a grid point, the more effect it has on that grid point.

The splines algorithm calculates an interpolation based on "thin plate splines". It does not take additional parameters.

The qnorm algorithm calculates a weighted average of the input data at each grid point. Each data point is weighted inversely by its distance from the grid point raised to the norm power. (Actually, the weights are given by the inverse of dx^norm + dy^norm, where dx and dy are the components of the separation of the grid point from each data point. For some norms that are powers of two, specifically 4, 8, and 16, the computation is optimized by using the Euclidean distance in the weight calculation, (dx^2+dy^2)^norm/2. However, any non-negative integer can be used.) The power of the norm can be specified as a single optional parameter. This algorithm is the default.

Finally, several smoothing kernels are available to calculate weighted averages: z = Sum_i w(d_i) * z_i / Sum_i w(d_i), where z_i is the value of the i-th data point and d_i is the distance between the current grid point and the location of the i-th data point. All kernels assign higher weights to data points that are close to the current grid point and lower weights to data points further away.

The following kernels are available:

gauss :     w(d) = exp(-d*d)
cauchy :    w(d) = 1/(1 + d*d)
exp :       w(d) = exp(-d)
box :       w(d) = 1                     if d<1
                 = 0                     otherwise
hann :      w(d) = 0.5*(1-cos(2*pi*d))   if d<1
            w(d) = 0                     otherwise

When using one of these five smoothing kernels, up to two additional numerical parameters can be specified: dx and dy. These are used to rescale the coordinate differences when calculating the distance: d_i = sqrt( ((x-x_i)/dx)**2 + ((y-y_i)/dy)**2 ), where x,y are the coordinates of the current grid point and x_i,y_i are the coordinates of the i-th data point. The value of dy defaults to the value of dx, which defaults to 1. The parameters dx and dy make it possible to control the radius over which data points contribute to a grid point IN THE UNITS OF THE DATA ITSELF.

The optional keyword kdensity, which must come after the name of the kernel, but before the (optional) scale parameters, modifies the algorithm so that the values calculated for the grid points are not divided by the sum of the weights ( z = Sum_i w(d_i) * z_i ). If all z_i are constant, this effectively plots a bivariate kernel density estimate: a kernel function (one of the five defined above) is placed at each data point, the sum of these kernels is evaluated at every grid point, and this smooth surface is plotted instead of the original data. This is similar in principle to + what the smooth kdensity option does to 1D datasets. (See kdensity2d.dem for usage demo)

A slightly different syntax is also supported for reasons of backwards compatibility. If no interpolation algorithm has been explicitly selected, the qnorm algorithm is assumed. Up to three comma-separated, optional parameters can be specified, which are interpreted as the the number of rows, the number of columns, and the norm value, respectively.

The dgrid3d option is a simple scheme which replaces scattered data with weighted averages on a regular grid. More sophisticated approaches to this problem exist and should be used to preprocess the data outside gnuplot if this simple solution is found inadequate.

See also

dgrid3d.dem: dgrid3d demo.

and

scatter.dem: dgrid3d demo.

Dummy

The set dummy command changes the default dummy variable names.

Syntax:

set dummy {<dummy-var>} {,<dummy-var>}
show dummy

By default, gnuplot assumes that the independent, or "dummy", variable for the plot command is "t" if in parametric or polar mode, or "x" otherwise. Similarly the independent variables for the splot command are "u" and "v" in parametric mode (splot cannot be used in polar mode), or "x" and "y" otherwise.

It may be more convenient to call a dummy variable by a more physically meaningful or conventional name. For example, when plotting time functions:

set dummy t
plot sin(t), cos(t)

Examples:

set dummy u,v
set dummy ,s

The second example sets the second variable to s. To reset the dummy variable names to their default values, use

unset dummy

Encoding

The set encoding command selects a character encoding.

Syntax:

set encoding {<value>}
set encoding locale
show encoding

Valid values are

default     - tells a terminal to use its default encoding
iso_8859_1  - the most common Western European encoding used by many
              Unix workstations and by MS-Windows. This encoding is
              known in the PostScript world as 'ISO-Latin1'.
iso_8859_15 - a variant of iso_8859_1 that includes the Euro symbol
iso_8859_2  - used in Central and Eastern Europe
iso_8859_9  - used in Turkey (also known as Latin5)
koi8r       - popular Unix cyrillic encoding
koi8u       - Ukrainian Unix cyrillic encoding
cp437       - codepage for MS-DOS
cp850       - codepage for OS/2, Western Europe
cp852       - codepage for OS/2, Central and Eastern Europe
cp950       - MS version of Big5 (emf terminal only)
cp1250      - codepage for MS Windows, Central and Eastern Europe
cp1251      - codepage for 8-bit Russian, Serbian, Bulgarian, Macedonian
cp1252      - codepage for MS Windows, Western Europe
cp1254      - codepage for MS Windows, Turkish (superset of Latin5)
sjis        - shift-JIS Japanese encoding
utf8        - variable-length (multibyte) representation of Unicode
              entry point for each character

The command set encoding locale is different from the other options. It attempts to determine the current locale from the runtime environment. On most systems this is controlled by the environmental variables LC_ALL, LC_CTYPE, or LANG. This mechanism is necessary, for example, to pass multibyte character encodings such as UTF-8 or EUC_JP to the wxt and cairopdf terminals. This command does not affect the locale-specific representation of dates or numbers. See also set locale and set decimalsign.

Generally you must set the encoding before setting the terminal type. Note that encoding is not supported by all terminal drivers and that the device must be able to produce the desired non-standard characters.

Fit

The set fit command controls the options for the fit command.

Syntax:

set fit {logfile {"<filename>"|default}}
        {{no}quiet|results|brief|verbose}
        {{no}errorvariables}
        {{no}covariancevariables}
        {{no}errorscaling}
        {{no}prescale}
        {maxiter <value>|none}
        {limit <epsilon>|default}
        {limit_abs <epsilon_abs>   
        {start-lambda <value>|default}
        {lambda-factor <value>|default}
        {script {"<command>"|default}}
unset fit
show fit

The logfile option defines where the fit command writes its output. The <filename> argument must be enclosed in single or double quotes. If no filename is given or unset fit is used the log file is reset to its default value "fit.log" or the value of the environmental variable FIT_LOG. If the given logfile name ends with a / or \, it is interpreted to be a directory name, and the actual filename will be "fit.log" in that directory.

By default the information written to the log file is also echoed to the terminal session. set fit quiet turns off the echo, whereas results prints only final results. brief gives one line summaries for every iteration of the fit in addition. verbose yields detailed iteration reports as it was the default before version 5.

If the errorvariables option is turned on, the error of each fitted parameter computed by fit will be copied to a user-defined variable whose name is formed by appending "_err" to the name of the parameter itself. This is useful mainly to put the parameter and its error onto a plot of the data and the fitted function, for reference, as in:

set fit errorvariables
fit f(x) 'datafile' using 1:2 via a, b
print "error of a is:", a_err
set label 'a=%6.2f', a, '+/- %6.2f', a_err
plot 'datafile' using 1:2, f(x)

If the errorscaling option is specified, which is the default, the calculated parameter errors are scaled with the reduced chi square. This is equivalent to providing data errors equal to the calculated standard deviation of the fit (FIT_STDFIT) resulting in a reduced chi square of one. With the noerrorscaling option the estimated errors are the unscaled standard deviations of the fit parameters. If no weights are specified for the data, parameter errors are always scaled.

If the prescale option is turned on, parameters are prescaled by their initial values before being passed to the Marquardt-Levenberg routine. This helps tremendously if there are parameters that differ in size by many orders of magnitude. Fit parameters with an initial value of exactly zero are never prescaled.

The maximum number of iterations may be limited with the maxiter option. A value of 0 or default means that there is no limit.

The limit option can be used to change the default epsilon limit (1e-5) to detect convergence. When the sum of squared residuals changes by a factor less than this number (epsilon), the fit is considered to have 'converged'. The limit_abs option imposes an additional absolute limit in the change of the sum of squared residuals and defaults to zero.

If you need even more control about the algorithm, and know the Marquardt-Levenberg algorithm well, the following options can be used to influence it. The startup value of lambda is normally calculated automatically from the ML-matrix, but if you want to, you may provide your own using the start_lambda option. Setting it to default will re-enable the automatic selection. The option lambda_factor sets the factor by which lambda is increased or decreased whenever the chi-squared target function increased or decreased significantly. Setting it to default re-enables the default factor of 10.0.

The script option may be used to specify a gnuplot command to be executed when a fit is interrupted---see fit. This setting takes precedence over the default of replot and the environment variable FIT_SCRIPT.

If the covariancevariables option is turned on, the covariances between final parameters will be saved to user-defined variables. The variable name for a certain parameter combination is formed by prepending "FIT_COV_" to the name of the first parameter and combining the two parameter names by "_". For example given the parameters "a" and "b" the covariance variable is named "FIT_COV_a_b".

Fontpath

The fontpath setting defines additional locations for font files searched when including font files. Currently only the postscript terminal supports fontpath. If a file cannot be found in the current directory, the directories in fontpath are tried. Further documentation concerning the supported file formats is included in the terminal postscript section of the documentation.

Syntax:

set fontpath {"pathlist1" {"pathlist2"...}}
show fontpath

Path names may be entered as single directory names, or as a list of path names separated by a platform-specific path separator, eg. colon (':') on Unix, semicolon (';') on DOS/Windows/OS/2 platforms. The show fontpath, save and save set commands replace the platform-specific separator with a space character (' ') for maximum portability. If a directory name ends with an exclamation mark ('!') also the subdirectories of this directory are searched for font files.

If the environmental variable GNUPLOT_FONTPATH is set, its contents are appended to fontpath. If it is not set, a system dependent default value is used. It is set by testing several directories for existence when using the fontpath the first time. Thus, the first call of set fontpath, show fontpath, save fontpath, plot, or splot with embedded font files takes a little more time. If you want to save this time you may set the environmental variable GNUPLOT_FONTPATH since probing is switched off, then. You can find out which is the default fontpath by using show fontpath.

show fontpath prints the contents of the user-defined fontpath and the system fontpath separately. However, the save and save set commands save only the user-specified parts of fontpath.

For terminal drivers that access fonts by filename via the gd library, the font search path is controlled by the environmental variable GDFONTPATH.

Format

The format of the tic-mark labels can be set with the set format command or with the set tics format or individual set {axis}tics format commands.

Syntax:

set format {<axes>} {"<format-string>"}
set format {<axes>} {'<format-string>'}
show format

where <axes> is either x, y, xy, x2, y2, z, cb or nothing (which applies the format to all axes). The following two commands are equivalent:

set format y "%.2f"
set ytics format "%.2f"

The length of the string is restricted to 100 characters. The default format is "% h", "$%h$" for LaTeX terminals. Other formats such as "%.2f" or "%3.0em" are often desirable. "set format" with no following string will restore the default.

If the empty string "" is given, tics will have no labels, although the tic mark will still be plotted. To eliminate the tic marks, use unset xtics or set tics scale 0.

Newline (\n) and enhanced text markup is accepted in the format string. Use double-quotes rather than single-quotes in this case. See also syntax. Characters not preceded by "%" are printed verbatim. Thus you can include spaces and labels in your format string, such as "%g m", which will put " m" after each number. If you want "%" itself, double it: "%g %%".

See also set xtics for more information about tic labels, and set decimalsign for how to use non-default decimal separators in numbers printed this way. See also

electron demo (electron.dem).

Gprintf

The string function gprintf("format",x) uses gnuplot's own format specifiers, as do the gnuplot commands set format, set timestamp, and others. These format specifiers are not the same as those used by the standard C-language routine sprintf(). gprintf() accepts only a single variable to be formatted. Gnuplot also provides an sprintf("format",x1,x2,...) routine if you prefer. For a list of gnuplot's format options, see format specifiers.

Format specifiers

The acceptable formats (if not in time/date mode) are:

Format Explanation
%f floating point notation
%e or %E exponential notation; an "e" or "E" before the power
%g or %G the shorter of %e (or %E) and %f
%h or %H %g with "x10^{%S}" or "*10^{%S}" instead of "e%S"
%x or %X hex
%o or %O octal
%t mantissa to base 10
%l mantissa to base of current logscale
%s mantissa to base of current logscale; scientific power
%T power to base 10
%L power to base of current logscale
%S scientific power
%c character replacement for scientific power
%b mantissa of ISO/IEC 80000 notation (ki, Mi, Gi, Ti, Pi, Ei, Zi, Yi)
%B prefix of ISO/IEC 80000 notation (ki, Mi, Gi, Ti, Pi, Ei, Zi, Yi)
%P multiple of π

A 'scientific' power is one such that the exponent is a multiple of three. Character replacement of scientific powers ("%c") has been implemented for powers in the range -18 to +18. For numbers outside of this range the format reverts to exponential.

Other acceptable modifiers (which come after the "%" but before the format specifier) are "-", which left-justifies the number; "+", which forces all numbers to be explicitly signed; " " (a space), which makes positive numbers have a space in front of them where negative numbers have "-"; "#", which places a decimal point after floats that have only zeroes following the decimal point; a positive integer, which defines the field width; "0" (the digit, not the letter) immediately preceding the field width, which indicates that leading zeroes are to be used instead of leading blanks; and a decimal point followed by a non-negative integer, which defines the precision (the minimum number of digits of an integer, or the number of digits following the decimal point of a float).

Some systems may not support all of these modifiers but may also support others; in case of doubt, check the appropriate documentation and then experiment.

Examples:

set format y "%t"; set ytics (5,10)          # "5.0" and "1.0"
set format y "%s"; set ytics (500,1000)      # "500" and "1.0"
set format y "%+-12.3f"; set ytics(12345)    # "+12345.000  "
set format y "%.2t*10^%+03T"; set ytic(12345)# "1.23*10^+04"
set format y "%s*10^{%S}"; set ytic(12345)   # "12.345*10^{3}"
set format y "%s %cg"; set ytic(12345)       # "12.345 kg"
set format y "%.0P pi"; set ytic(6.283185)   # "2 pi"
set format y "%.0f%%"; set ytic(50)          # "50%"
set log y 2; set format y '%l'; set ytics (1,2,3)
#displays "1.0", "1.0" and "1.5" (since 3 is 1.5 * 2^1)

There are some problem cases that arise when numbers like 9.999 are printed with a format that requires both rounding and a power.

If the data type for the axis is time/date, the format string must contain valid codes for the 'strftime' function (outside of gnuplot, type "man strftime"). See set timefmt for a list of the allowed input format codes.

Time/date specifiers

In time/date mode, the acceptable formats are:

Format Explanation
%a abbreviated name of day of the week
%A full name of day of the week
%b or %h abbreviated name of the month
%B full name of the month
%d day of the month, 01–31
%D shorthand for %m/%d/%y (only output)
%F shorthand for %Y-%m-%d (only output)
%k hour, 0–23 (one or two digits)
%H hour, 00–23 (always two digits)
%l hour, 1–12 (one or two digits)
%I hour, 01–12 (always two digits)
%j day of the year, 1–366
%m month, 01–12
%M minute, 0–60
%p "am" or "pm"
%r shorthand for %I:%M:%S %p (only output)
%R shorthand for %H:%M (only output)
%S second, integer 0–60 on output, (double) on input
%s number of seconds since start of year 1970
%T shorthand for %H:%M:%S (only output)
%U week of the year (week starts on Sunday)
%w day of the week, 0–6 (Sunday = 0)
%W week of the year (week starts on Monday)
%y year, 0-99 in range 1969-2068
%Y year, 4-digit

Except for the non-numerical formats, these may be preceded by a "0" ("zero", not "oh") to pad the field length with leading zeroes, and a positive digit, to define the minimum field width (which will be overridden if the specified width is not large enough to contain the number). The %S format also accepts a precision specifier so that fractional seconds can be written. There is a 24-character limit to the length of the printed text; longer strings will be truncated.

Examples:

Suppose the text is "76/12/25 23:11:11". Then

set format x                 # defaults to "12/25/76" \n "23:11"
set format x "%A, %d %b %Y"  # "Saturday, 25 Dec 1976"
set format x "%r %D"         # "11:11:11 pm 12/25/76"

Suppose the text is "98/07/06 05:04:03.123456". Then

set format x "%1y/%2m/%3d %01H:%02M:%06.3S"  # "98/ 7/  6 5:04:03.123"

Function style

This form of the command is deprecated. Please see set style function.

Functions

The show functions command lists all user-defined functions and their definitions.

Syntax:

show functions

For information about the definition and usage of functions in gnuplot, please see expressions. See also

splines as user defined functions (spline.dem)

and

use of functions and complex variables for airfoils (airfoil.dem).

Grid

The set grid command allows grid lines to be drawn on the plot.

Syntax:

set grid {{no}{m}xtics} {{no}{m}ytics} {{no}{m}ztics}
         {{no}{m}x2tics} {{no}{m}y2tics}
         {{no}{m}cbtics}
         {polar {<angle>}}
         {layerdefault | front | back}
         { {linestyle <major_linestyle>}
           | {linetype | lt <major_linetype>}
             {linewidth | lw <major_linewidth>}
           { , {linestyle | ls <minor_linestyle>}
               | {linetype | lt <minor_linetype>}
                 {linewidth | lw <minor_linewidth>} } }
unset grid
show grid

The grid can be enabled and disabled for the major and/or minor tic marks on any axis, and the linetype and linewidth can be specified for major and minor grid lines, also via a predefined linestyle, as far as the active terminal driver supports this.

Additionally, a polar grid can be selected for 2D plots---circles are drawn to intersect the selected tics, and radial lines are drawn at definable intervals. (The interval is given in degrees or radians, depending on the set angles setting.) Note that a polar grid is no longer automatically generated in polar mode.

The pertinent tics must be enabled before set grid can draw them; gnuplot will quietly ignore instructions to draw grid lines at non-existent tics, but they will appear if the tics are subsequently enabled.

If no linetype is specified for the minor gridlines, the same linetype as the major gridlines is used. The default polar angle is 30 degrees.

If front is given, the grid is drawn on top of the graphed data. If back is given, the grid is drawn underneath the graphed data. Using front will prevent the grid from being obscured by dense data. The default setup, layerdefault, is equivalent to back for 2D plots. In 3D plots the default is to split up the grid and the graph box into two layers: one behind, the other in front of the plotted data and functions. Since hidden3d mode does its own sorting, it ignores all grid drawing order options and passes the grid lines through the hidden line removal machinery instead. These options actually affect not only the grid, but also the lines output by set border and the various ticmarks (see set xtics).

Z grid lines are drawn on the bottom of the plot. This looks better if a partial box is drawn around the plot---see set border.

Hidden3d

The set hidden3d command enables hidden line removal for surface plotting (see splot). Some optional features of the underlying algorithm can also be controlled using this command.

Syntax:

set hidden3d {defaults} |
             { {front|back}
               {{offset <offset>} | {nooffset}}
               {trianglepattern <bitpattern>}
               {{undefined <level>} | {noundefined}}
               {{no}altdiagonal}
               {{no}bentover} }
unset hidden3d
show hidden3d

In contrast to the usual display in gnuplot, hidden line removal actually treats the given function or data grids as real surfaces that can't be seen through, so plot elements behind the surface will be hidden by it. For this to work, the surface needs to have 'grid structure' (see splot datafile about this), and it has to be drawn with lines or with linespoints.

When hidden3d is set, both the hidden portion of the surface and possibly its contours drawn on the base (see set contour) as well as the grid will be hidden. Each surface has its hidden parts removed with respect to itself and to other surfaces, if more than one surface is plotted. Contours drawn on the surface (set contour surface) don't work.

As of gnuplot version 4.6, hidden3d also affects 3D plotting styles points, labels, vectors, and impulses even if no surface is present in the graph. Individual plots within the graph may be explicitly excluded from this processing by appending the extra option nohidden3d to the with specifier.

Hidden3d does not affect solid surfaces drawn using the pm3d mode. To achieve a similar effect purely for pm3d surfaces, use instead set pm3d depthorder. To mix pm3d surfaces with normal hidden3d processing, use the option set hidden3d front to force all elements included in hidden3d processing to be drawn after any remaining plot elements, including the pm3d surface.

Functions are evaluated at isoline intersections. The algorithm interpolates linearly between function points or data points when determining the visible line segments. This means that the appearance of a function may be different when plotted with hidden3d than when plotted with nohidden3d because in the latter case functions are evaluated at each sample. Please see set samples and set isosamples for discussion of the difference.

The algorithm used to remove the hidden parts of the surfaces has some additional features controllable by this command. Specifying defaults will set them all to their default settings, as detailed below. If defaults is not given, only explicitly specified options will be influenced: all others will keep their previous values, so you can turn on/off hidden line removal via set {no}hidden3d, without modifying the set of options you chose.

The first option, offset, influences the linetype used for lines on the 'back' side. Normally, they are drawn in a linetype one index number higher than the one used for the front, to make the two sides of the surface distinguishable. You can specify a different linetype offset to add instead of the default 1, by offset <offset>. Option nooffset stands for offset 0, making the two sides of the surface use the same linetype.

Next comes the option trianglepattern <bitpattern>. <bitpattern> must be a number between 0 and 7, interpreted as a bit pattern. Each bit determines the visibility of one edge of the triangles each surface is split up into. Bit 0 is for the 'horizontal' edges of the grid, Bit 1 for the 'vertical' ones, and Bit 2 for the diagonals that split each cell of the original grid into two triangles. The default pattern is 3, making all horizontal and vertical lines visible, but not the diagonals. You may want to choose 7 to see those diagonals as well.

The undefined <level> option lets you decide what the algorithm is to do with data points that are undefined (missing data, or undefined function values), or exceed the given x-, y- or z-ranges. Such points can either be plotted nevertheless, or taken out of the input data set. All surface elements touching a point that is taken out will be taken out as well, thus creating a hole in the surface. If <level> = 3, equivalent to option noundefined, no points will be thrown away at all. This may produce all kinds of problems elsewhere, so you should avoid this. <level> = 2 will throw away undefined points, but keep the out-of-range ones. <level> = 1, the default, will get rid of out-of-range points as well.

By specifying noaltdiagonal, you can override the default handling of a special case can occur if undefined is active (i.e. <level> is not 3). Each cell of the grid-structured input surface will be divided in two triangles along one of its diagonals. Normally, all these diagonals have the same orientation relative to the grid. If exactly one of the four cell corners is excluded by the undefined handler, and this is on the usual diagonal, both triangles will be excluded. However if the default setting of altdiagonal is active, the other diagonal will be chosen for this cell instead, minimizing the size of the hole in the surface.

The bentover option controls what happens to another special case, this time in conjunction with the trianglepattern. For rather crumply surfaces, it can happen that the two triangles a surface cell is divided into are seen from opposite sides (i.e. the original quadrangle is 'bent over'), as illustrated in the following ASCII art:

C----B
|\   |
| \  |
|  \ |
|   \|
A    D

If the diagonal edges of the surface cells aren't generally made visible by bit 2 of the <bitpattern> there, the edge CB above wouldn't be drawn at all, normally, making the resulting display hard to understand. Therefore, the default option of bentover will turn it visible in this case. If you don't want that, you may choose nobentover instead. See also

hidden line removal demo (hidden.dem)

and

complex hidden line demo (singulr.dem).

Historysize

(Deprecated). set historysize N is equivalent to set history size N. unset historysize is equivalent to set history size -1.

History

Syntax:

set history {size <N>} {quiet|numbers} {full|trim} {default}

When leaving gnuplot the value of history size limits the number of lines saved to the history file. set history size -1 allows an unlimited number of lines to be written to the history file.

By default the history command prints a line number in front of each command. history quiet suppresses the number for this command only. set history quiet suppresses numbers for all future history commands.

The trim option reduces the number of duplicate lines in the history list by removing earlier instances of the current command. This was the default behavior prior to gnuplot version 5.

Default settings: set history size 500 numbers trim.

Isosamples

The isoline density (grid) for plotting functions as surfaces may be changed by the set isosamples command.

Syntax:

set isosamples <iso_1> {,<iso_2>}
show isosamples

Each function surface plot will have <iso_1> iso-u lines and <iso_2> iso-v lines. If you only specify <iso_1>, <iso_2> will be set to the same value as <iso_1>. By default, sampling is set to 10 isolines per u or v axis. A higher sampling rate will produce more accurate plots, but will take longer. These parameters have no effect on data file plotting.

An isoline is a curve parameterized by one of the surface parameters while the other surface parameter is fixed. Isolines provide a simple means to display a surface. By fixing the u parameter of surface s(u,v), the iso-u lines of the form c(v) = s(u0,v) are produced, and by fixing the v parameter, the iso-v lines of the form c(u) = s(u,v0) are produced.

When a function surface plot is being done without the removal of hidden lines, set samples controls the number of points sampled along each isoline; see set samples and set hidden3d. The contour algorithm assumes that a function sample occurs at each isoline intersection, so change in samples as well as isosamples may be desired when changing the resolution of a function surface/contour.

Key

The set key command enables a key (or legend) containing a title and a sample (line, point, box) for each plot in the graph. The key may be turned off by requesting set key off or unset key. Individual key entries may be turned off by using the notitle keyword in the corresponding plot command. The text of the titles is controlled by the set key autotitle option or by the title keyword of individual plot and splot commands. See plot title for more information.

Syntax:

set key {on|off} {default}
      {{inside | outside} | {lmargin | rmargin | tmargin | bmargin}
        | {at <position>}}
      {left | right | center} {top | bottom | center}
      {vertical | horizontal} {Left | Right}
      {{no}opaque}
      {{no}reverse} {{no}invert}
      {samplen <sample_length>} {spacing <vertical_spacing>}
      {width <width_increment>} {height <height_increment>}
      {{no}autotitle {columnheader}}
      {title "<text>"} {{no}enhanced}
      {font "<face>,<size>"} {textcolor <colorspec>}
      {{no}box {linestyle <style> | linetype <type> | linewidth <width>}}
      {maxcols {<max no. of columns> | auto}}
      {maxrows {<max no. of rows> | auto}}
unset key
show key

Elements within the key are stacked according to vertical or horizontal. In the case of vertical, the key occupies as few columns as possible. That is, elements are aligned in a column until running out of vertical space at which point a new column is started. The vertical space may be limited using 'maxrows'. In the case of horizontal, the key occupies as few rows as possible. The horizontal space may be limited using 'maxcols'.

By default the key is placed in the upper right inside corner of the graph. The keywords left, right, top, bottom, center, inside, outside, lmargin, rmargin, tmargin, bmargin (, above, over, below and under) may be used to automatically place the key in other positions of the graph. Also an at <position> may be given to indicate precisely where the plot should be placed. In this case, the keywords left, right, top, bottom and center serve an analogous purpose for alignment. For more information, see key placement.

Justification of the plot titles within the key is controlled by Left or Right (default). The text and sample can be reversed (reverse) and a box can be drawn around the key (box {...}) in a specified linetype and linewidth, or a user-defined linestyle.

By default the key is built up one plot at a time. That is, the key symbol and title are drawn at the same time as the corresponding plot. That means newer plots may sometimes place elements on top of the key. set key opaque causes the key to be generated after all the plots. In this case the key area is filled with background color and then the key symbols and titles are written. Therefore the key itself may obscure portions of some plot elements. The default can be restored by set key noopaque.

By default the first plot label is at the top of the key and successive labels are entered below it. The invert option causes the first label to be placed at the bottom of the key, with successive labels entered above it. This option is useful to force the vertical ordering of labels in the key to match the order of box types in a stacked histogram.

The <height_increment> is a number of character heights to be added to or subtracted from the height of the key box. This is useful mainly when you are putting a box around the key and want larger borders around the key entries.

All plotted curves of plots and splots are titled according to the default option autotitles. The automatic generation of titles can be suppressed by noautotitles; then only those titles explicitly defined by (s)plot ... title ... will be drawn.

The command set key autotitle columnheader causes the first entry in each column of input data to be interpreted as a text string and used as a title for the corresponding plot. If the quantity being plotted is a function of data from several columns, gnuplot may be confused as to which column to draw the title from. In this case it is necessary to specify the column explicitly in the plot command, e.g.

plot "datafile" using (($2+$3)/$4) title columnhead(3) with lines

An overall title can be put on the key (title "<text>")---see also syntax for the distinction between text in single- or double-quotes. The key title uses the same justification as do the plot titles.

The defaults for set key are on, right, top, vertical, Right, noreverse, noinvert, samplen 4, spacing 1.25, title "", and nobox. The default <linetype> is the same as that used for the plot borders. Entering set key default returns the key to its default configuration.

The key is drawn as a sequence of lines, with one plot described on each line. On the right-hand side (or the left-hand side, if reverse is selected) of each line is a representation that attempts to mimic the way the curve is plotted. On the other side of each line is the text description (the line title), obtained from the plot command. The lines are vertically arranged so that an imaginary straight line divides the left- and right-hand sides of the key. It is the coordinates of the top of this line that are specified with the set key command. In a plot, only the x and y coordinates are used to specify the line position. For a splot, x, y and z are all used as a 3D location mapped using the same mapping as the graph itself to form the required 2D screen position of the imaginary line.

When using the TeX or other terminals where formatting information is embedded in the string, gnuplot can only estimate the correctly exact width of the string for key positioning. If the key is to be positioned at the left, it may be convenient to use the combination set key left Left reverse.

If splot is being used to draw contours, by default the contour labels will be listed in the key. You can adjust this display using set cntrlabel format.

Examples:

This places the key at the default location:

set key default

This disables the key:

unset key

This places a key at coordinates 2,3.5,2 in the default (first) coordinate system:

set key at 2,3.5,2

This places the key below the graph:

set key below

This places the key in the bottom left corner, left-justifies the text, gives it a title, and draws a box around it in linetype 3:

set key left bottom Left title 'Legend' box 3

Key placement

To understand positioning, the best concept is to think of a region, i.e., inside/outside, or one of the margins. Along with the region, keywords left/center/right (l/c/r) and top/center/bottom (t/c/b) control where within the particular region the key should be placed.

When in inside mode, the keywords left (l), right (r), top (t), bottom (b), and center (c) push the key out toward the plot boundary as illustrated:

t/l   t/c   t/r
c/l    c    c/r
b/l   b/c   b/r

When in outside mode, automatic placement is similar to the above illustration, but with respect to the view, rather than the graph boundary. That is, a border is moved inward to make room for the key outside of the plotting area, although this may interfere with other labels and may cause an error on some devices. The particular plot border that is moved depends upon the position described above and the stacking direction. For options centered in one of the dimensions, there is no ambiguity about which border to move. For the corners, when the stack direction is vertical, the left or right border is moved inward appropriately. When the stack direction is horizontal, the top or bottom border is moved inward appropriately.

The margin syntax allows automatic placement of key regardless of stack direction. When one of the margins lmargin (lm), rmargin (rm), tmargin (tm), and bmargin (bm) is combined with a single, non-conflicting direction keyword, the following illustrated positions may contain the key:

l/tm  c/tm  r/tm
t/lm                  t/rm
c/lm                  c/rm
b/lm                  b/rm
l/bm  c/bm  r/bm

Keywords above and over are synonymous with tmargin. For version compatibility, above or over without an additional l/c/r or stack direction keyword uses center and horizontal. Keywords below and under are synonymous with bmargin. For compatibility, below or under without an additional l/c/r or stack direction keyword uses center and horizontal. A further compatibility issue is that outside appearing without an additional t/b/c or stack direction keyword uses top, right and vertical (i.e., the same as t/rm above).

The <position> can be a simple x,y,z as in previous versions, but these can be preceded by one of five keywords (first, second, graph, screen, character) which selects the coordinate system in which the position of the first sample line is specified. See coordinates for more details. The effect of left, right, top, bottom, and center when <position> is given is to align the key as though it were text positioned using the label command, i.e., left means left align with key to the right of <position>, etc.

Key samples

By default, each plot on the graph generates a corresponding entry in the key. This entry contains a plot title and a sample line/point/box of the same color and fill properties as used in the plot itself. The font and textcolor properties control the appearance of the individual plot titles that appear in the key. Setting the textcolor to "variable" causes the text for each key entry to be the same color as the line or fill color for that plot. This was the default in some earlier versions of gnuplot.

The length of the sample line can be controlled by samplen. The sample length is computed as the sum of the tic length and <sample_length> times the character width. samplen also affects the positions of point samples in the key since these are drawn at the midpoint of the sample line, even if the sample line itself is not drawn.

The vertical spacing between lines is controlled by spacing. The spacing is set equal to the product of the pointsize, the vertical tic size, and <vertical_spacing>. The program will guarantee that the vertical spacing is no smaller than the character height.

The <width_increment> is a number of character widths to be added to or subtracted from the length of the string. This is useful only when you are putting a box around the key and you are using control characters in the text. gnuplot simply counts the number of characters in the string when computing the box width; this allows you to correct it.

Label

Arbitrary labels can be placed on the plot using the set label command.

Syntax:

set label {<tag>} {"<label text>"} {at <position>}
          {left | center | right}
          {norotate | rotate {by <degrees>}}
          {font "<name>{,<size>}"}
          {noenhanced}
          {front | back}
          {textcolor <colorspec>}
          {point <pointstyle> | nopoint}
          {offset <offset>}
          {boxed}
          {hypertext}
unset label {<tag>}
show label

The <position> is specified by either x,y or x,y,z, and may be preceded by first, second, graph, screen, or character to select the coordinate system. See coordinates for details.

The tag is an integer that is used to identify the label. If no <tag> is given, the lowest unused tag value is assigned automatically. The tag can be used to delete or modify a specific label. To change any attribute of an existing label, use the set label command with the appropriate tag, and specify the parts of the label to be changed.

The <label text> can be a string constant, a string variable, or a string- valued expression. See strings, sprintf, and gprintf.

By default, the text is placed flush left against the point x,y,z. To adjust the way the label is positioned with respect to the point x,y,z, add the justification parameter, which may be left, right or center, indicating that the point is to be at the left, right or center of the text. Labels outside the plotted boundaries are permitted but may interfere with axis labels or other text.

Some terminals support enclosing the label in a box. See set style textbox. Note: Currently the boxed enclosure is limited to unrotated text.

If rotate is given, the label is written vertically (if the terminal can do so, of course). If rotate by <degrees> is given, conforming terminals will try to write the text at the specified angle; non-conforming terminals will treat this as vertical text.

Font and its size can be chosen explicitly by font "<name>{,<size>}" if the terminal supports font settings. Otherwise the default font of the terminal will be used.

Normally the enhanced text mode string interpretation, if enabled for the current terminal, is applied to all text strings including label text. The noenhanced property can be used to exempt a specific label from the enhanced text mode processing. The can be useful if the label contains underscores, for example. See enhanced text.

If front is given, the label is written on top of the graphed data. If back is given (the default), the label is written underneath the graphed data. Using front will prevent a label from being obscured by dense data.

textcolor <colorspec> changes the color of the label text. <colorspec> can be a linetype, an rgb color, or a palette mapping. See help for colorspec and palette. textcolor may be abbreviated tc.

`tc default` resets the text color to its default state.
`tc lt <n>` sets the text color to that of line type <n>.
`tc ls <n>` sets the text color to that of line style <n>.
`tc palette z` selects a palette color corresponding to the label z position.
`tc palette cb <val>` selects a color corresponding to <val> on the colorbar.
`tc palette fraction <val>`, with 0<=val<=1, selects a color corresponding to
    the mapping [0:1] to grays/colors of the `palette`.
`tc rgb "#RRGGBB"` or `tc rgb "0xRRGGBB"` sets an arbitrary 24-bit RGB color.
`tc rgb 0xRRGGBB`  As above; a hexadecimal constant does not require quotes.

If a <pointstyle> is given, using keywords lt, pt and ps, see style, a point with the given style and color of the given line type is plotted at the label position and the text of the label is displaced slightly. This option is used by default for placing labels in mouse enhanced terminals. Use nopoint to turn off the drawing of a point near the label (this is the default).

The displacement defaults to 1,1 in pointsize units if a <pointstyle> is given, 0,0 if no <pointstyle> is given. The displacement can be controlled by the optional offset <offset> where <offset> is specified by either x,y or x,y,z, and may be preceded by first, second, graph, screen, or character to select the coordinate system. See coordinates for details.

If one (or more) axis is timeseries, the appropriate coordinate should be given as a quoted time string according to the timefmt format string. See set xdata and set timefmt.

The options available for set label are also available for the labels plot style. See labels.

Examples

Examples:

To set a label at (1,2) to "y=x", use:

set label "y=x" at 1,2

To set a Sigma of size 24, from the Symbol font set, at the center of the graph, use:

set label "S" at graph 0.5,0.5 center font "Symbol,24"

To set a label "y=x^2" with the right of the text at (2,3,4), and tag the label as number 3, use:

set label 3 "y=x^2" at 2,3,4 right

To change the preceding label to center justification, use:

set label 3 center

To delete label number 2, use:

unset label 2

To delete all labels, use:

unset label

To show all labels (in tag order), use:

show label

To set a label on a graph with a timeseries on the x axis, use, for example:

set timefmt "%d/%m/%y,%H:%M"
set label "Harvest" at "25/8/93",1

To display a freshly fitted parameter on the plot with the data and the fitted function, do this after the fit, but before the plot:

set label sprintf("a = %3.5g",par_a) at 30,15
bfit = gprintf("b = %s*10^%S",par_b)
set label bfit at 30,20

To display a function definition along with its fitted parameters, use:

f(x)=a+b*x
fit f(x) 'datafile' via a,b
set label GPFUN_f at graph .05,.95
set label sprintf("a = %g", a) at graph .05,.90 
set label sprintf("b = %g", b) at graph .05,.85

To set a label displaced a little bit from a small point:

set label 'origin' at 0,0 point lt 1 pt 2 ps 3 offset 1,-1

To set a label whose color matches the z value (in this case 5.5) of some point on a 3D splot colored using pm3d:

set label 'text' at 0,0,5.5 tc palette z

Hypertext

Some terminals (wxt, qt, svg, canvas, win) allow you to attach hypertext to specific points on the graph or elsewhere on the canvas. When the mouse hovers over the anchor point, a pop-up box containing the text is displayed. Terminals that do not support hypertext will display nothing. You must enable the point attribute of the label in order for the hypertext to be anchored. Examples:

set label at 0,0 "Plot origin" hypertext point pt 1
plot 'data' using 1:2:0 with labels hypertext point pt 7 \
     title 'mouse over point to see its order in data set'

Linetype

The set linetype command allows you to redefine the basic linetypes used for plots. The command options are identical to those for "set style line". Unlike line styles, redefinitions by set linetype are persistent; they are not affected by reset.

For example, linetypes one and two default to red and green. If you redefine them like this:

set linetype 1 lw 2 lc rgb "blue" pointtype 6
set linetype 2 lw 2 lc rgb "forest-green" pointtype 8

everywhere that uses lt 1 will now get a thick blue line rather than a thin red line (the previous default meaning of lt 1). This includes uses such as the definition of a temporary linestyle derived from the base linetype 1.

Note: This command was introduced in gnuplot version 4.6. It supersedes an older rather cryptic command "set style increment user". The older command is now deprecated.

This mechanism can be used to define a set of personal preferences for the sequence of lines used in gnuplot. The recommended way to do this is to add to the run-time initialization file ~/.gnuplot a sequence of commands like

if ((GPVAL_VERSION < 4.5) \
||  (!strstrt(GPVAL_COMPILE_OPTIONS,"+USER_LINETYPES"))) \
    exit
set linetype 1 lc rgb "dark-violet" lw 2 pt 0
set linetype 2 lc rgb "sea-green"   lw 2 pt 7
set linetype 3 lc rgb "cyan"        lw 2 pt 6 pi -1
set linetype 4 lc rgb "dark-red"    lw 2 pt 5 pi -1
set linetype 5 lc rgb "blue"        lw 2 pt 8
set linetype 6 lc rgb "dark-orange" lw 2 pt 3
set linetype 7 lc rgb "black"       lw 2 pt 11
set linetype 8 lc rgb "goldenrod"   lw 2
set linetype cycle 8

Every time you run gnuplot the line types will be initialized to these values. You may initialize as many linetypes as you like. If you do not redefine, say, linetype 3 then it will continue to have the default properties (in this case blue, pt 3, lw 1, etc). The first few lines of the example script insure that the commands will be skipped by older versions of gnuplot.

Similar script files can be used to define theme-based color choices, or sets of colors optimized for a particular plot type or output device.

The command set linetype cycle 8 tells gnuplot to re-use these definitions for the color and linewidth of higher-numbered linetypes. That is, linetypes 9-16, 17-24, and so on will use this same sequence of colors and widths. The point properties (pointtype, pointsize, pointinterval) are not affected by this command. unset linetype cycle disables this feature. If the line properties of a higher numbered linetype are explicitly defined, this takes precedence over the recycled low-number linetype properties.

Link

Syntax:

set link {x2 | y2} {via <expression1> inverse <expression2>}
unset link

The set link command establishes a mapping between the x and x2 axes, or the y and y2 axes. <expression1> maps primary axis coordinates onto the secondary axis. <expression2> maps secondary axis coordinates onto the primary axis.

Examples:

set link x

This is the simplest form of the command. It forces the x2 axis to have identically the same range, scale, and direction as the x axis. Commands set xrange, set auto x, etc will affect both the x and x2 axes. Commands set x2range, etc, will be ignored while the linkage is in effect.

set link x2 via x**2 inverse sqrt(x)
plot "sqrt_data" using 1:2 axes x2y1, "linear_data" using 1:2 axes x1y1

This command establishes forward and reverse mapping between the x and x2 axes. The forward mapping is used to generate x2 tic labels and x2 mouse coordinate The reverse mapping is used to plot coordinates given in the x2 coordinate system. Note that the mapping as given is valid only for x non-negative. When mapping to the y2 axis, both <expression1> and <expression2> must use y as dummy variable.

Lmargin

The command set lmargin sets the size of the left margin. Please see set margin for details.

Loadpath

The loadpath setting defines additional locations for data and command files searched by the call, load, plot and splot commands. If a file cannot be found in the current directory, the directories in loadpath are tried.

Syntax:

set loadpath {"pathlist1" {"pathlist2"...}}
show loadpath

Path names may be entered as single directory names, or as a list of path names separated by a platform-specific path separator, eg. colon (':') on Unix, semicolon (';') on DOS/Windows/OS/2 platforms. The show loadpath, save and save set commands replace the platform-specific separator with a space character (' ').

If the environment variable GNUPLOT_LIB is set, its contents are appended to loadpath. However, show loadpath prints the contents of set loadpath and GNUPLOT_LIB separately. Also, the save and save set commands ignore the contents of GNUPLOT_LIB.

Locale

The locale setting determines the language with which {x,y,z}{d,m}tics will write the days and months.

Syntax:

set locale {"<locale>"}

<locale> may be any language designation acceptable to your installation. See your system documentation for the available options. The command set locale "" will try to determine the locale from the LC_TIME, LC_ALL, or LANG environment variables.

To change the decimal point locale, see set decimalsign. To change the character encoding to the current locale, see set encoding.

Logscale

Syntax:

set logscale <axes> {<base>}
unset logscale <axes>
show logscale

where <axes> may be any combinations of x, x2, y, y2, z, cb, and r in any order. <base> is the base of the log scaling (default is base 10). If no axes are specified, the command affects all axes except r. The command unset logscale turns off log scaling for all axes. Note that the ticmarks generated for logscaled axes are not uniformly spaced. See set xtics.

Examples:

To enable log scaling in both x and z axes:

set logscale xz

To enable scaling log base 2 of the y axis:

set logscale y 2

To enable z and color log axes for a pm3d plot:

set logscale zcb

To disable z axis log scaling:

unset logscale z

Macros

If command line macro substitution is enabled, then tokens in the command line of the form @<stringvariablename> will be replaced by the text string contained in <stringvariablename>. See substitution.

Syntax:

set macros

Mapping

If data are provided to splot in spherical or cylindrical coordinates, the set mapping command should be used to instruct gnuplot how to interpret them.

Syntax:

set mapping {cartesian | spherical | cylindrical}

A cartesian coordinate system is used by default.

For a spherical coordinate system, the data occupy two or three columns (or using entries). The first two are interpreted as the azimuthal and polar angles theta and phi (or "longitude" and "latitude"), in the units specified by set angles. The radius r is taken from the third column if there is one, or is set to unity if there is no third column. The mapping is:

x = r * cos(theta) * cos(phi)
y = r * sin(theta) * cos(phi)
z = r * sin(phi)

Note that this is a "geographic" spherical system, rather than a "polar" one (that is, phi is measured from the equator, rather than the pole).

For a cylindrical coordinate system, the data again occupy two or three columns. The first two are interpreted as theta (in the units specified by set angles) and z. The radius is either taken from the third column or set to unity, as in the spherical case. The mapping is:

x = r * cos(theta)
y = r * sin(theta)
z = z

The effects of mapping can be duplicated with the using filter on the splot command, but mapping may be more convenient if many data files are to be processed. However even if mapping is used, using may still be necessary if the data in the file are not in the required order.

mapping has no effect on plot.

See also

world.dem: mapping demos.

Margin

The margin is the distance between the plot border and the outer edge of the canvas. The size of the margin is chosen automatically, but can be overridden by the set margin commands. show margin shows the current settings. To alter the distance between the inside of the plot border and the data in the plot itself, see set offsets.

Syntax:

set bmargin {{at screen} <margin>}
set lmargin {{at screen} <margin>}
set rmargin {{at screen} <margin>}
set tmargin {{at screen} <margin>}
show margin

The default units of <margin> are character heights or widths, as appropriate. A positive value defines the absolute size of the margin. A negative value (or none) causes gnuplot to revert to the computed value. For 3D plots, only the left margin can be set using character units.

The keywords at screen indicates that the margin is specified as a fraction of the full drawing area. This can be used to precisely line up the corners of individual 2D and 3D graphs in a multiplot. This placement ignores the current values of set origin and set size, and is intended as an alternative method for positioning graphs within a multiplot.

Normally the margins of a plot are automatically calculated based on tics, tic labels, axis labels, the plot title, the timestamp and the size of the key if it is outside the borders. If, however, tics are attached to the axes (set xtics axis, for example), neither the tics themselves nor their labels will be included in either the margin calculation or the calculation of the positions of other text to be written in the margin. This can lead to tic labels overwriting other text if the axis is very close to the border.

Mouse

The command set mouse enables mouse actions for the current interactive terminal. It is usually enabled by default in interactive mode, but disabled by default if commands are being read from a file.

There are two mouse modes. The 2D mode works for plot commands and for splot maps (i.e. set view with z-rotation 0, 90, 180, 270 or 360 degrees, including set view map). In this mode the mouse position is tracked and you can pan or zoom using the mouse buttons or arrow keys. Some terminals support toggling individual plots on/off by clicking on the corresponding key title or on a separate widget.

For 3D graphs splot, the view and scaling of the graph can be changed with mouse buttons 1 and 2, respectively. A vertical motion of Button 2 with the shift key held down changes the xyplane. If additionally to these buttons the modifier <ctrl> is held down, the coordinate axes are displayed but the data are suppressed. This is useful for large data sets.

Mousing is not available inside multiplot mode. When multiplot is completed using unset multiplot, then the mouse will be turned on again but acts only on the most recent plot within the multiplot (like replot does).

Syntax:

set mouse {doubleclick <ms>} {nodoubleclick} \
          {{no}zoomcoordinates} \
          {noruler | ruler {at x,y}} \
          {polardistance{deg|tan} | nopolardistance} \
          {format <string>} \
          {mouseformat <int>/<string>} \
          {{no}labels {"labeloptions"}} \
          {{no}zoomjump} {{no}verbose}
unset mouse

The options noruler and ruler switch the ruler off and on, the latter optionally setting the origin at the given coordinates. While the ruler is on, the distance in user units from the ruler origin to the mouse is displayed continuously. By default, toggling the ruler has the key binding 'r'.

The option polardistance determines if the distance between the mouse cursor and the ruler is also shown in polar coordinates (distance and angle in degrees or tangent (slope)). This corresponds to the default key binding '5'.

Choose the option labels to define persistent gnuplot labels using Button 2. The default is nolabels, which makes Button 2 draw only a temporary label at the mouse position. Labels are drawn with the current setting of mouseformat. The labeloptions string is passed to the set label command. The default is "point pointstyle 1" which will plot a small plus at the label position. Temporary labels will disappear at the next replot or mouse zoom operation. Persistent labels can be removed by holding the Ctrl-Key down while clicking Button 2 on the label's point. The threshold for how close you must be to the label is also determined by the pointsize.

If the option verbose is turned on the communication commands are shown during execution. This option can also be toggled by hitting 6 in the driver's window. verbose is off by default.

Press 'h' in the driver's window for a short summary of the mouse and key bindings. This will also display user defined bindings or hotkeys which can be defined using the bind command, see help for bind. Note, that user defined hotkeys may override the default bindings. See also help for bind and label.

Doubleclick

The doubleclick resolution is given in milliseconds and used for Button 1, which copies the current mouse position to the clipboard. The default value is 300 ms. Setting the value to 0 ms triggers the copy on a single click.

Mouseformat

The set mouse format command specifies a format string for sprintf() which determines how the mouse cursor [x,y] coordinates are printed to the plot window and to the clipboard. The default is "% #g".

set mouse mouseformat is used for formatting the text on Button1 and Button2 actions -- copying the coordinates to the clipboard and temporarily annotating the mouse position. An integer argument selects one of the format options in the table below. A string argument is used as a format for sprintf() in option 6 and should contain two float specifiers. Example:

`set mouse mouseformat "mouse x,y = %5.2g, %10.3f"`.

Use set mouse mouseformat "" to turn this string off again.

The following formats are available:

Scrolling

X and Y axis scaling in both 2D and 3D graphs can be adjusted using the mouse wheel. <wheel-up> scrolls up (increases both YMIN and YMAX by ten percent of the Y range, and increases both Y2MIN and Y2MAX likewise), and <wheel down> scrolls down. <shift-wheel-up> scrolls left (decreases both XMIN and XMAX, and both X2MIN and X2MAX), and <shift-wheel-down> scrolls right. <control-wheel-up> zooms in toward the center of the plot, and <control-wheel-down> zooms out. <shift-control-wheel-up> zooms in along the X and X2 axes only, and <shift-control-wheel-down> zooms out along the X and X2 axes only.

X11 mouse

If multiple X11 plot windows have been opened using the set term x11 <n> terminal option, then only the current plot window supports the entire range of mouse commands and hotkeys. The other windows will, however, continue to display mouse coordinates at the lower left.

Zoom

Zooming is usually accomplished by holding down the left mouse button and dragging the mouse to delineate a zoom region. Some platforms may require using a different mouse button. The original plot can be restored by typing the 'u' hotkey in the plot window. The hotkeys 'p' and 'n' step back and forth through a history of zoom operations.

The option zoomcoordinates determines if the coordinates of the zoom box are drawn at the edges while zooming. This is on by default.

If the option zoomjump is on, the mouse pointer will be automatically offset a small distance after starting a zoom region with button 3. This can be useful to avoid a tiny (or even empty) zoom region. zoomjump is off by default.

Multiplot

The command set multiplot places gnuplot in the multiplot mode, in which several plots are placed on the same page, window, or screen.

Syntax:

set multiplot
    { title <page title> {font <fontspec>} {enhanced|noenhanced} }
    { layout <rows>,<cols> 
      {rowsfirst|columnsfirst} {downwards|upwards}
      {scale <xscale>{,<yscale>}} {offset <xoff>{,<yoff>}}
      {margins <left>,<right>,<bottom>,<top>}
      {spacing <xspacing>{,<yspacing>}}
    }
set multiplot {next|previous}
unset multiplot

For some terminals, no plot is displayed until the command unset multiplot is given, which causes the entire page to be drawn and then returns gnuplot to its normal single-plot mode. For other terminals, each separate plot command produces an updated display.

The clear command is used to erase the rectangular area of the page that will be used for the next plot. This is typically needed for "inset" plots.

Any labels or arrows that have been defined will be drawn for each plot according to the current size and origin (unless their coordinates are defined in the screen system). Just about everything else that can be set is applied to each plot, too. If you want something to appear only once on the page, for instance a single time stamp, you'll need to put a set time/unset time pair around one of the plot, splot or replot commands within the set multiplot/unset multiplot block.

The multiplot title is separate from the individual plot titles, if any. Space is reserved for it at the top of the page, spanning the full width of the canvas.

The commands set origin and set size must be used to correctly position each plot if no layout is specified or if fine tuning is desired. See set origin and set size for details of their usage.

Example:

set multiplot
set size 0.4,0.4
set origin 0.1,0.1
plot sin(x)
set size 0.2,0.2
set origin 0.5,0.5
plot cos(x)
unset multiplot

This displays a plot of cos(x) stacked above a plot of sin(x).

set size and set origin refer to the entire plotting area used for each plot. Please also see set term size. If you want to have the axes themselves line up, you can guarantee that the margins are the same size with the set margin commands. See set margin for their use. Note that the margin settings are absolute, in character units, so the appearance of the graph in the remaining space will depend on the screen size of the display device, e.g., perhaps quite different on a video display and a printer.

With the layout option you can generate simple multiplots without having to give the set size and set origin commands before each plot: Those are generated automatically, but can be overridden at any time. With layout the display will be divided by a grid with <rows> rows and <cols> columns. This grid is filled rows first or columns first depending on whether the corresponding option is given in the multiplot command. The stack of plots can grow downwards or upwards. Default is rowsfirst and downwards. The commands set multiplot next and set multiplot previous are relevant only in the context of using the layout option. next skips the next position in the grid, leaving a blank space. prev returns to the grid position immediately preceding the most recently plotted position.

Each plot can be scaled by scale and shifted with offset; if the y-values for scale or offset are omitted, the x-value will be used. unset multiplot will turn off the automatic layout and restore the values of set size and set origin as they were before set multiplot layout.

Example:

set size 1,1
set origin 0,0
set multiplot layout 3,2 columnsfirst scale 1.1,0.9
[ up to 6 plot commands here ]
unset multiplot

The above example will produce 6 plots in 2 columns filled top to bottom, left to right. Each plot will have a horizontal size of 1.1/2 and a vertical size of 0.9/3.

Another possibility is to set explicit margins for each plot with options margins and spacing. With margins you set the outer margins of the whole multiplot grid, given as fractions of the whole drawing area. This can be very useful if only some plots have labels but their sizes should all be equal.

Example:

set multiplot layout 2,2 columnsfirst margins 0.1,0.9,0.1,0.9 spacing 0.1
set ylabel 'ylabel'
plot sin(x)
set xlabel 'xlabel'
plot cos(x)
unset ylabel
unset xlabel
plot sin(2*x)
set xlabel 'xlabel'
plot cos(2*x)
unset multiplot

See also

multiplot demo (multiplt.dem)

Mx2tics

Minor tic marks along the x2 (top) axis are controlled by set mx2tics. Please see set mxtics.

Mxtics

Minor tic marks along the x axis are controlled by set mxtics. They can be turned off with unset mxtics. Similar commands control minor tics along the other axes.

Syntax:

set mxtics {<freq> | default}
unset mxtics
show mxtics

The same syntax applies to mytics, mztics, mx2tics, my2tics, mrtics and mcbtics.

<freq> is the number of sub-intervals (NOT the number of minor tics) between major tics (the default for a linear axis is either two or five depending on the major tics, so there are one or four minor tics between major tics). Selecting default will return the number of minor ticks to its default value.

If the axis is logarithmic, the number of sub-intervals will be set to a reasonable number by default (based upon the length of a decade). This will be overridden if <freq> is given. However the usual minor tics (2, 3, ..., 8, 9 between 1 and 10, for example) are obtained by setting <freq> to 10, even though there are but nine sub-intervals.

To set minor tics at arbitrary positions, use the ("<label>" <pos> <level>, ...) form of set {x|x2|y|y2|z}tics with <label> empty and <level> set to 1.

The set m{x|x2|y|y2|z}tics commands work only when there are uniformly spaced major tics. If all major tics were placed explicitly by set {x|x2|y|y2|z}tics, then minor tic commands are ignored. Implicit major tics and explicit minor tics can be combined using set {x|x2|y|y2|z}tics and set {x|x2|y|y2|z}tics add.

Examples:

set xtics 0, 5, 10
set xtics add (7.5)
set mxtics 5

Major tics at 0,5,7.5,10, minor tics at 1,2,3,4,6,7,8,9

set logscale y
set ytics format ""
set ytics 1e-6, 10, 1
set ytics add ("1" 1, ".1" 0.1, ".01" 0.01, "10^-3" 0.001, \
               "10^-4" 0.0001)
set mytics 10

Major tics with special formatting, minor tics at log positions

By default, minor tics are off for linear axes and on for logarithmic axes. They inherit the settings for axis|border and {no}mirror specified for the major tics. Please see set xtics for information about these.

My2tics

Minor tic marks along the y2 (right-hand) axis are controlled by set my2tics. Please see set mxtics.

Mytics

Minor tic marks along the y axis are controlled by set mytics. Please see set mxtics.

Mztics

Minor tic marks along the z axis are controlled by set mztics. Please see set mxtics.

Object

The set object command defines a single object which will appear in all subsequent 2D plots. You may define as many objects as you like. Currently the supported object types are rectangle, circle, ellipse, and polygon. Rectangles inherit a default set of style properties (fill, color, border) from those set by the command set style rectangle, but each object can also be given individual style properties. Circles, ellipses, and polygons inherit the fill style from set style fill.

Syntax:

set object <index>
    <object-type> <object-properties>
    {front|back|behind} {clip|noclip}
    {fc|fillcolor <colorspec>} {fs <fillstyle>}
    {default} {lw|linewidth <width>} {dt|dashtype <dashtype>}
unset object <index>

<object-type> is either rectangle, ellipse, circle, or polygon. Each object type has its own set of characteristic properties.

Setting front will draw the object in front of all plot elements, but behind any labels that are also marked front. Setting back will place the object behind all plot curves and labels. Setting behind will place the object behind everything including the axes and back rectangles, thus

set object rectangle from screen 0,0 to screen 1,1 behind

can be used to provide a colored background for the entire graph or page.

By default, objects are clipped to the graph boundary unless one or more vertices are given in screen coordinates. Setting noclip will disable clipping to the graph boundary, but will still clip against the screen size.

The fill color of the object is taken from the <colorspec>. fillcolor may be abbreviated fc. The fill style is taken from <fillstyle>. See colorspec and fillstyle. If the keyword default is given, these properties are inherited from the default settings at the time a plot is drawn. See set style rectangle.

Rectangle

Syntax:

set object <index> rectangle
    {from <position> {to|rto} <position> |
     center <position> size <w>,<h> |
     at <position> size <w>,<h>}

The position of the rectangle may be specified by giving the position of two diagonal corners (bottom left and top right) or by giving the position of the center followed by the width and the height. In either case the positions may be given in axis, graph, or screen coordinates. See coordinates. The options at and center are synonyms.

Examples:

# Force the entire area enclosed by the axes to have background color cyan
set object 1 rect from graph 0, graph 0 to graph 1, graph 1 back
set object 1 rect fc rgb "cyan" fillstyle solid 1.0
# Position a red square with lower left at 0,0 and upper right at 2,3
set object 2 rect from 0,0 to 2,3 fc lt 1
# Position an empty rectangle (no fill) with a blue border
set object 3 rect from 0,0 to 2,3 fs empty border rgb "blue"
# Return fill and color to the default style but leave vertices unchanged
set object 2 rect default

Rectangle corners specified in screen coordinates may extend beyond the edge of the current graph. Otherwise the rectangle is clipped to fit in the graph.

Ellipse

Syntax:

set object <index> ellipse {at|center} <position> size <w>,<h>
    {angle <orientation>} {units xy|xx|yy}
    {<other-object-properties>}

The position of the ellipse is specified by giving the center followed by the width and the height (actually the major and minor axes). The keywords at and center are synonyms. The center position may be given in axis, graph, or screen coordinates. See coordinates. The major and minor axis lengths must be given in axis coordinates. The orientation of the ellipse is specified by the angle between the horizontal axis and the major diameter of the ellipse. If no angle is given, the default ellipse orientation will be used instead (see set style ellipse). The units keyword controls the scaling of the axes of the ellipse. units xy means that the major axis is interpreted in terms of units along the x axis, while the minor axis in that of the y axis. units xx means that both axes of the ellipses are scaled in the units of the x axis, while units yy means that both axes are in units of the y axis. The default is xy or whatever set style ellipse units was set to.

NB: If the x and y axis scales are not equal, (e.g. units xy is in effect) then the major/minor axis ratio will no longer be correct after rotation.

Note that set object ellipse size <2r>,<2r> does not in general produce the same result as set object circle <r>. The circle radius is always interpreted in terms of units along the x axis, and will always produce a circle even if the x and y axis scales are different and even if the aspect ratio of your plot is not 1. If units is set to xy, then 'set object ellipse' interprets the first <2r> in terms of x axis units and the second <2r> in terms of y axis units. This will only produce a circle if the x and y axis scales are identical and the plot aspect ratio is 1. On the other hand, if units is set to xx or yy, then the diameters specified in the 'set object' command will be interpreted in the same units, so the ellipse will have the correct aspect ratio, and it will maintain its aspect ratio even if the plot is resized.

Circle

Syntax:

set object <index> circle {at|center} <position> size <radius>
    {arc [<begin>:<end>]}
    {<other-object-properties>}

The position of the circle is specified by giving the position of the center center followed by the radius. The keywords at and center are synonyms. The position and radius may be given in x-axis, graph, or canvas coordinates. See coordinates. In all cases the radius is calculated relative to the horizontal scale of the axis, graph, or canvas. Any disparity between the horizontal and vertical scaling will be corrected for so that the result is always a circle. If you want to draw a circle in plot coordinates (such that it will appear as an ellipse if the horizontal and vertical scales are different), use set object ellipse instead.

By default a full circle is drawn. The optional qualifier arc specifies a starting angle and ending angle, in degrees, for one arc of the circle. The arc is always drawn counterclockwise.

See also set object ellipse.

Polygon

Syntax:

set object <index> polygon
    from <position> to <position> ... {to <position>}

or

from <position> rto <position> ... {rto <position>}

The position of the polygon may be specified by giving the position of a sequence of vertices. These may be given in axis, graph, or screen coordinates. If relative coordinates are used (rto) then the coordinate type must match that of the previous vertex. See coordinates.

Example:

set object 1 polygon from 0,0 to 1,1 to 2,0
set object 1 fc rgb "cyan" fillstyle solid 1.0 border lt -1

Offsets

Offsets provide a mechanism to put an empty boundary around the data inside an autoscaled graph. The offsets only affect the x1 and y1 axes, and only in 2D plot commands.

Syntax:

set offsets <left>, <right>, <top>, <bottom>
unset offsets
show offsets

Each offset may be a constant or an expression. Each defaults to 0. By default, the left and right offsets are given in units of the first x axis, the top and bottom offsets in units of the first y axis. Alternatively, you may specify the offsets as a fraction of the total axis range by using the keyword "graph". A positive offset expands the axis range in the specified direction, e.g., a positive bottom offset makes ymin more negative. Negative offsets, while permitted, can have unexpected interactions with autoscaling and clipping. To prevent the auto-scaling from further adjusting your axis ranges, it is useful to also specify "set auto fix".

Example:

set auto fix
set offsets graph 0.05, 0, 2, 2
plot sin(x)

This graph of sin(x) will have a y range [-3:3] because the function will be autoscaled to [-1:1] and the vertical offsets are each two. The x range will be [-11:10] because the default is [-10:10] and it has been expanded to the left by 0.05 of that total range.

Origin

The set origin command is used to specify the origin of a plotting surface (i.e., the graph and its margins) on the screen. The coordinates are given in the screen coordinate system (see coordinates for information about this system).

Syntax:

set origin <x-origin>,<y-origin>

Output

By default, screens are displayed to the standard output. The set output command redirects the display to the specified file or device.

Syntax:

set output {"<filename>"}
show output

The filename must be enclosed in quotes. If the filename is omitted, any output file opened by a previous invocation of set output will be closed and new output will be sent to STDOUT. (If you give the command set output "STDOUT", your output may be sent to a file named "STDOUT"! ["May be", not "will be", because some terminals, like x11 or wxt, ignore set output.])

When both set terminal and set output are used together, it is safest to give set terminal first, because some terminals set a flag which is needed in some operating systems. This would be the case, for example, if the operating system needs a separate open command for binary files.

On platforms that support pipes, it may be useful to pipe terminal output. For instance,

set output "|lpr -Plaser filename"
set term png; set output "|display png:-"

On MSDOS machines, set output "PRN" will direct the output to the default printer. On VMS, output can be sent directly to any spooled device.

Parametric

The set parametric command changes the meaning of plot (splot) from normal functions to parametric functions. The command unset parametric restores the plotting style to normal, single-valued expression plotting.

Syntax:

set parametric
unset parametric
show parametric

For 2D plotting, a parametric function is determined by a pair of parametric functions operating on a parameter. An example of a 2D parametric function would be plot sin(t),cos(t), which draws a circle (if the aspect ratio is set correctly---see set size). gnuplot will display an error message if both functions are not provided for a parametric plot.

For 3D plotting, the surface is described as x=f(u,v), y=g(u,v), z=h(u,v). Therefore a triplet of functions is required. An example of a 3D parametric function would be cos(u)*cos(v),cos(u)*sin(v),sin(u), which draws a sphere. gnuplot will display an error message if all three functions are not provided for a parametric splot.

The total set of possible plots is a superset of the simple f(x) style plots, since the two functions can describe the x and y values to be computed separately. In fact, plots of the type t,f(t) are equivalent to those produced with f(x) because the x values are computed using the identity function. Similarly, 3D plots of the type u,v,f(u,v) are equivalent to f(x,y).

Note that the order the parametric functions are specified is xfunction, yfunction (and zfunction) and that each operates over the common parametric domain.

Also, the set parametric function implies a new range of values. Whereas the normal f(x) and f(x,y) style plotting assume an xrange and yrange (and zrange), the parametric mode additionally specifies a trange, urange, and vrange. These ranges may be set directly with set trange, set urange, and set vrange, or by specifying the range on the plot or splot commands. Currently the default range for these parametric variables is [-5:5]. Setting the ranges to something more meaningful is expected.

Paxis

Syntax:

set paxis <axisno> {range <range-options> | tics <tic-options>}
show paxis <axisno> {range | tics}

The set paxis command is equivalent to the set xrange and set xtics commands except that it acts on one of the axes p1, p2, ... used in parallel axis plots. The normal options to these commands are accepted although not all options make sense for this kind of plot. See set xrange, set xtics.

Plot

The show plot command shows the current plotting command as it results from the last plot and/or splot and possible subsequent replot commands.

In addition, the show plot add2history command adds this current plot command into the history. It is useful if you have used replot to add more curves to the current plot and you want to edit the whole command now.

Pm3d

pm3d is an splot style for drawing palette-mapped 3d and 4d data as color/gray maps and surfaces. It uses an algorithm that allows plotting gridded as well as non-gridded data without preprocessing, even when the data scans do not have the same number of points.

Syntax (the options can be given in any order):

set pm3d {
           { at <position> }
           { interpolate <steps/points in scan, between scans> }
           { scansautomatic | scansforward | scansbackward | depthorder }
           { flush { begin | center | end } }
           { ftriangles | noftriangles }
           { clip1in | clip4in }
           { corners2color
             { mean|geomean|harmean|rms|median|min|max|c1|c2|c3|c4 }
           }
           { hidden3d {<linestyle>} | nohidden3d }
           { implicit | explicit }
           { map }
         }
show pm3d
unset pm3d

A pm3d color surface is drawn if the splot command specifies with pm3d, if the data or function style is set to pm3d globally, or if the pm3d mode is set pm3d implicit. In the latter two cases, the pm3d surface is draw in addition to the mesh produced by the style specified in the plot command. E.g.

splot 'fred.dat' with lines, 'lola.dat' with lines

would draw both a mesh of lines and a pm3d surface for each data set. If the option explicit is on (or implicit is off) only plots specified by the with pm3d attribute are plotted with a pm3d surface, e.g.:

splot 'fred.dat' with lines, 'lola.dat' with pm3d

would plot 'fred.dat' with lines (only) and 'lola.dat' with a pm3d surface.

On gnuplot start-up, the mode is explicit. For historical and compatibility reasons, the commands set pm3d; (i.e. no options) and set pm3d at X ... (i.e. at is the first option) change the mode to implicit. The command set pm3d; sets other options to their default state.

If you set the default data or function style to pm3d, e.g.:

set style data pm3d

then the options implicit and explicit have no effect.

Note that when plotting several plots, they are plotted in the order given on the command line. This can be of interest especially for filled surfaces which can overwrite and therefore hide part of earlier plots.

The pm3d coloring can be drawn at any or all of three different positions, top, bottom, or surface. See pm3d position. The following command draws three color surfaces at different altitudes:

set border 4095
set pm3d at s
splot 10*x with pm3d at b, x*x-y*y, x*x+y*y with pm3d at t

See also help for set palette, set cbrange, set colorbox, and definitely the demo file demo/pm3d.dem.

Algorithm

Let us first describe how a map/surface is drawn. The input data come from an evaluated function or from an splot data file. Each surface consists of a sequence of separate scans (isolines). The pm3d algorithm fills the region between two neighbouring points in one scan with another two points in the next scan by a gray (or color) according to z-values (or according to an additional 'color' column, see help for using) of these 4 corners; by default the 4 corner values are averaged, but this can be changed by the option corners2color. In order to get a reasonable surface, the neighbouring scans should not cross and the number of points in the neighbouring scans should not differ too much; of course, the best plot is with scans having same number of points. There are no other requirements (e.g. the data need not be gridded). Another advantage is that the pm3d algorithm does not draw anything outside of the input (measured or calculated) region.

Surface coloring works with the following input data:

1. splot of function or of data file with one or three data columns: The gray/color scale is obtained by mapping the averaged (or corners2color) z-coordinate of the four corners of the above-specified quadrangle into the range [min_color_z,max_color_z] of zrange or cbrange providing a gray value in the range [0:1]. This value can be used directly as the gray for gray maps. The normalized gray value can be further mapped into a color---see set palette for the complete description.

2. splot of data file with two or four data columns: The gray/color value is obtained by using the last-column coordinate instead of the z-value, thus allowing the color and the z-coordinate be mutually independent. This can be used for 4d data drawing.

Other notes:

1. The term 'scan' referenced above is used more among physicists than the term 'iso_curve' referenced in gnuplot documentation and sources. You measure maps recorded one scan after another scan, that's why.

2. The 'gray' or 'color' scale is a linear mapping of a continuous variable onto a smoothly varying palette of colors. The mapping is shown in a rectangle next to the main plot. This documentation refers to this as a "colorbox", and refers to the indexing variable as lying on the colorbox axis. See set colorbox, set cbrange.

3. To use pm3d coloring to generate a two-dimensional plot rather than a 3D surface, use set view map or set pm3d map.

Position

Color surface can be drawn at the base or top (then it is a gray/color planar map) or at z-coordinates of surface points (gray/color surface). This is defined by the at option with a string of up to 6 combinations of b, t and s. For instance, at b plots at bottom only, at st plots firstly surface and then top map, while at bstbst will never by seriously used.

Colored quadrangles are plotted one after another. When plotting surfaces (at s), the later quadrangles overlap (overdraw) the previous ones. (Gnuplot is not virtual reality tool to calculate intersections of filled polygon meshes.) You may try to switch between scansforward and scansbackward to force the first scan of the data to be plotted first or last. The default is scansautomatic where gnuplot makes a guess about scans order. On the other hand, the depthorder option completely reorders the quadrangles. The rendering is performed after a depth sorting, which allows to visualize even complicated surfaces; see pm3d depthorder for more details.

Scanorder

By default the quadrangles making up a pm3d solid surface are rendered in the order they are encountered along the surface grid points. This order may be controlled by the options scansautomatic|scansforward|scansbackward. These scan options are not in general compatible with hidden-surface removal.

If two successive scans do not have same number of points, then it has to be decided whether to start taking points for quadrangles from the beginning of both scans (flush begin), from their ends (flush end) or to center them (flush center). Note, that flush (center|end) are incompatible with scansautomatic: if you specify flush center or flush end and scansautomatic is set, it is silently switched to scansforward.

If two subsequent scans do not have the same number of points, the option ftriangles specifies whether color triangles are drawn at the scan tail(s) where there are not enough points in either of the scans. This can be used to draw a smooth map boundary.

Gnuplot does not do true hidden surface removal for solid surfaces, but often it is sufficient to render the component quadrangles in order from furthest to closest. This mode may be selected using the options

set pm3d depthorder hidden3d

The depthorder option orders the solid quadrangles; the hidden3d option similarly orders the bounding lines (if drawn). Note that the global option set hidden3d does not affect pm3d surfaces.

Clipping

Clipping with respect to x, y coordinates of quadrangles can be done in two ways. clip1in: all 4 points of each quadrangle must be defined and at least 1 point of the quadrangle must lie in the x and y ranges. clip4in: all 4 points of each quadrangle must lie in the x and y ranges.

Color_assignment

3 columns of data (x,y,z):

The coloring setup as well as the color box drawing are determined by set palette. There can be only one palette for the current plot. Drawing of several surfaces with different palettes can be achieved by multiplot with fixed origin and size; don't forget to use set palette maxcolors when your terminal is running out of available colors.

There is a single gray/color value associated to each drawn pm3d quadrangle (it contains a solid color, not a gradient). The value is calculated from z-coordinates the four corners according to corners2color <option>. 4 columns of data (x,y,z,color):

If a fourth column of data is provided, it is normally interpreted as a separate palette-mapped gray value. The coloring of individual quadrangles works as above, except that the color value is distinct from the z value. As a separate coloring option, the fourth data column may provide instead an RGB color. See rgbcolor variable. In this case the plotting command must be

splot ... using 1:2:3:4 with pm3d lc rgb variable

Another drawing algorithm, which would draw quadrangles around a given node by taking corners from averaged (x,y)-coordinates of its surrounding 4 nodes while using node's color, could be implemented in the future. This is already done for drawing images (2D grids) via image and rgbimage styles.

Notice that ranges of z-values and color-values for surfaces are adjustable independently by set zrange, set cbrange, as well as set log for z or cb. Maps can be adjusted by the cb-axis only; see also set view map and set colorbox.

Corners2color

The color of each quadrangle in a pm3d surface is assigned based on the color values of its four bounding vertices. The options 'mean' (default), 'geomean', 'harmean, 'rms', and 'median' produce various kinds of surface color smoothing, while options 'min' and 'max' choose minimal or maximal value, respectively. This may not be desired for pixel images or for maps with sharp and intense peaks, in which case the options 'c1', 'c2', 'c3' or 'c4' can be used instead to assign the quadrangle color based on the z-coordinate of only one corner. Some experimentation may be needed to determine which corner corresponds to 'c1', as the orientation depends on the drawing direction. Because the pm3d algorithm does not extend the colored surface outside the range of the input data points, the 'c<j>' coloring options will result in pixels along two edges of the grid not contributing to the color of any quadrangle. For example, applying the pm3d algorithm to the 4x4 grid of data points in script demo/pm3d.dem (please have a look) produces only (4-1)x(4-1)=9 colored rectangles.

Border

The option set pm3d border {line-properties} draws bounding lines around each quadrangle as it is rendered. Normally this is used in conjunction with the depthorder option to approximate hidden line removal. Note that the global option set hidden3d has no effect on pm3d plots. Default line properties (color, width) optionally follow the keyword border. These defaults can be overridden later in an splot command.

Example of recommended usage:

set pm3d at s depthorder border lw 0.2 lt black
unset hidden3d
unset surf
splot x*x+y*y linecolor rgb "blue"	# otherwise it would be black

NB: The deprecated option set pm3d hidden3d N is still accepted. It is equivalent to set pm3d border ls N.

Interpolate

The option interpolate m,n will interpolate between grid points to generate a finer mesh. For data files, this smooths the color surface and enhances the contrast of spikes in the surface. When working with functions, interpolation makes little sense. It would usually make more sense to increase samples and isosamples.

For positive m and n, each quadrangle or triangle is interpolated m-times and n-times in the respective direction. For negative m and n, the interpolation frequency is chosen so that there will be at least |m| and |n| points drawn; you can consider this as a special gridding function.

Note: interpolate 0,0, will automatically choose an optimal number of interpolated surface points.

Note: Currently color interpolation is always linear, even if corners2color is set to a nonlinear scheme such as the geometric mean.

Deprecated_options

There used to be an option {transparent|solid} to this command. Now you get the same effect from set grid {front|layerdefault}, respectively.

The command set pm3d map is equivalent to set pm3d at b; set view map; set style data pm3d; set style func pm3d;.

Palette

Palette is a color storage for use by pm3d, filled color contours or polygons, color histograms, color gradient background, and whatever it is or it will be implemented... Here it stands for a palette of smooth "continuous" colors or grays, but let's call it just a palette.

Color palettes require terminal entries for filled color polygons and palettes of smooth colors, are currently available for terminals listed in help for set pm3d. The range of color values are adjustable independently by set cbrange and set log cb. The whole color palette is visualized in the colorbox.

Syntax:

set palette
set palette {
           { gray | color }
           { gamma <gamma> }
           {   rgbformulae <r>,<g>,<b>
             | defined { ( <gray1> <color1> {, <grayN> <colorN>}... ) }
             | file '<filename>' {datafile-modifiers}
             | functions <R>,<G>,<B>
           }
           { cubehelix {start <val>} {cycles <val>} {saturation <val>} }
           { model { RGB | HSV | CMY | YIQ | XYZ } }
           { positive | negative }
           { nops_allcF | ps_allcF }
           { maxcolors <maxcolors> }
         }
show palette
show palette palette <n> {{float | int}}
show palette gradient
show palette fit2rgbformulae
show palette rgbformulae
show colornames

set palette (i.e. without options) sets up the default values. Otherwise, the options can be given in any order. show palette shows the current palette properties.

show palette gradient displays the gradient defining the palette (if appropriate). show palette rgbformulae prints the available fixed gray --> color transformation formulae. show colornames prints the known color names.

show palette palette <n> prints to the screen or to the file given by set print a table of RGB triplets calculated for the current palette settings and a palette having <n> discrete colors. The default wide table can be limited to 3 columns of r,g,b float values [0..1] or integer values [0..255] by options float or int, respectively. This way, the current gnuplot color palette can be loaded into other imaging applications, for example Octave. Alternatively, the test palette command will plot the R,G,B profiles for the current palette and leave the profile values in a datablock $PALETTE.

The following options determine the coloring properties.

Figure using this palette can be gray or color. For instance, in pm3d color surfaces the gray of each small spot is obtained by mapping the averaged z-coordinate of the 4 corners of surface quadrangles into the range [min_z,max_z] providing range of grays [0:1]. This value can be used directly as the gray for gray maps. The color map requires a transformation gray --> (R,G,B), i.e. a mapping [0:1] --> ([0:1],[0:1],[0:1]).

Basically two different types of mappings can be used: Analytic formulae to convert gray to color, or discrete mapping tables which are interpolated. palette rgbformulae and palette functions use analytic formulae whereas palette defined and palette file use interpolated tables. palette rgbformulae reduces the size of postscript output to a minimum.

The command show palette fit2rgbformulae finds the best matching set palette rgbformulae for the current set palette. Naturally, it makes sense to use it for non-rgbformulae palettes. This command can be found useful mainly for external programs using the same rgbformulae definition of palettes as gnuplot, like zimg (

http://zimg.sourceforge.net

).

set palette gray switches to a gray only palette. set palette rgbformulae, set palette defined, set palette file and set palette functions switch to a color mapping. set palette color is an easy way to switch back from the gray palette to the last color mapping.

Automatic gamma correction via set palette gamma <gamma> can be done for gray maps (set palette gray) and for the cubehelix color palette schemes. Gamma = 1 produces a linear ramp of intensity. See test palette.

Many terminals support only discrete number of colors (e.g. 256 colors in gif). After the default gnuplot linetype colors are allocated, the rest of the available colors are by default reserved for pm3d. Thus a multiplot using multiple palettes could fail because the first palette has used all the available color positions. You can mitigate this limitation by using set palette maxcolors <N> with a reasonably small value of N. This option causes N discrete colors to be selected from a continuous palette sampled at equally spaced intervals. If you want unequal spacing of N discrete colors, use set palette defined instead of a single continuous palette.

RGB color space might not be the most useful color space to work in. For that reason you may change the color space with model to one of RGB, HSV, CMY, YIQ and XYZ. Using color names for set palette defined tables and a color space other than RGB will result in funny colors. All explanation have been written for RGB color space, so please note, that R can be H, C, Y, or X, depending on the actual color space (G and B accordingly).

All values for all color spaces are limited to [0,1].

RGB stands for Red, Green and Blue; CMY stands for Cyan, Magenta and Yellow; HSV stands for Hue, Saturation, and Value; YIQ is the color model used by the U.S. Commercial Color Television Broadcasting, it is basically an RGB recoding with downward compatibility for black and white television; XYZ are the three primary colors of the color model defined by the 'Commission Internationale de l'Eclairage' (CIE). For more information on color models see:

http://en.wikipedia.org/wiki/Color_space

Rgbformulae

For rgbformulae three suitable mapping functions have to be chosen. This is done via rgbformulae <r>,<g>,<b>. The available mapping functions are listed by show palette rgbformulae. Default is 7,5,15, some other examples are 3,11,6, 21,23,3 or 3,23,21. Negative numbers, like 3,-11,-6, mean inverted color (i.e. 1-gray passed into the formula, see also positive and negative options below).

Some nice schemes in RGB color space

7,5,15   ... traditional pm3d (black-blue-red-yellow)
3,11,6   ... green-red-violet
23,28,3  ... ocean (green-blue-white); try also all other permutations
21,22,23 ... hot (black-red-yellow-white)
30,31,32 ... color printable on gray (black-blue-violet-yellow-white)
33,13,10 ... rainbow (blue-green-yellow-red)
34,35,36 ... AFM hot (black-red-yellow-white)

A full color palette in HSV color space

3,2,2    ... red-yellow-green-cyan-blue-magenta-red

Please note that even if called rgbformulae the formulas might actually determine the <H>,<S>,<V> or <X>,<Y>,<Z> or ... color components as usual.

Use positive and negative to invert the figure colors.

Note that it is possible to find a set of the best matching rgbformulae for any other color scheme by the command

show palette fit2rgbformulae

Defined

Gray-to-rgb mapping can be manually set by use of palette defined: A color gradient is defined and used to give the rgb values. Such a gradient is a piecewise linear mapping from gray values in [0,1] to the RGB space [0,1]x[0,1]x[0,1]. You must specify the gray values and the corresponding RGB values between which linear interpolation will be done.

Syntax:

set palette  defined { ( <gray1> <color1> {, <grayN> <colorN>}... ) }

<grayX> are gray values which are mapped to [0,1] and <colorX> are the corresponding rgb colors. The color can be specified in three different ways:

<color> :=  { <r> <g> <b> | '<color-name>' | '#rrggbb' }

Either by three numbers (each in [0,1]) for red, green and blue, separated by whitespace, or the name of the color in quotes or X style color specifiers also in quotes. You may freely mix the three types in a gradient definition, but the named color "red" will be something strange if RGB is not selected as color space. Use show colornames for a list of known color names.

Please note, that even if written as <r>, this might actually be the <H> component in HSV color space or <X> in CIE-XYZ space, or ... depending on the selected color model.

The <gray> values have to form an ascending sequence of real numbers; the sequence will be automatically rescaled to [0,1].

set palette defined (without a gradient definition in braces) switches to RGB color space and uses a preset full-spectrum color gradient. Use show palette gradient to display the gradient.

Examples:

To produce a gray palette (useless but instructive) use:

set palette model RGB
set palette defined ( 0 "black", 1 "white" )

To produce a blue yellow red palette use (all equivalent):

set palette defined ( 0 "blue", 1 "yellow", 2 "red" )
set palette defined ( 0 0 0 1, 1 1 1 0, 2 1 0 0 )
set palette defined ( 0 "#0000ff", 1 "#ffff00", 2 "#ff0000" )

To produce some rainbow-like palette use:

set palette defined ( 0 "blue", 3 "green", 6 "yellow", 10 "red" )

Full color spectrum within HSV color space:

set palette model HSV
set palette defined ( 0 0 1 1, 1 1 1 1 )
set palette defined ( 0 0 1 0, 1 0 1 1, 6 0.8333 1 1, 7 0.8333 0 1)

Approximate the default palette used by MATLAB:

set pal defined (1 '#00008f', 8 '#0000ff', 24 '#00ffff', \
                 40 '#ffff00', 56 '#ff0000', 64 '#800000')

To produce a palette with only a few, equally-spaced colors:

set palette model RGB maxcolors 4
set palette defined ( 0 "yellow", 1 "red" )

'Traffic light' palette (non-smooth color jumps at gray = 1/3 and 2/3).

set palette model RGB
set palette defined (0 "dark-green", 1 "green", \
                     1 "yellow",     2 "dark-yellow", \
                     2 "red",        3 "dark-red" )

Functions

Use set palette functions <Rexpr>, <Gexpr>, <Bexpr> to define three formulae for the R(gray), G(gray) and B(gray) mapping. The three formulae may depend on the variable gray which will take values in [0,1] and should also produce values in [0,1]. Please note that <Rexpr> might be a formula for the H-value if HSV color space has been chosen (same for all other formulae and color spaces).

Examples:

To produce a full color palette use:

set palette model HSV functions gray, 1, 1

A nice black to gold palette:

set palette model XYZ functions gray**0.35, gray**0.5, gray**0.8

A gamma-corrected black and white palette

gamma = 2.2
color(gray) = gray**(1./gamma)
set palette model RGB functions color(gray), color(gray), color(gray)

Cubehelix

The "cubehelix" option defines a family of palettes in which color (hue) varies along the standard color wheel while at the same time the net intensity increases monotonically as the gray value goes from 0 to 1.

D A Green (2011) http://arxiv.org/abs/1108.5083

start defines the starting point along the color wheel in radians. cycles defines how many color wheel cycles span the palette range. Larger values of saturation produce more saturated color; saturation > 1 may lead to clipping of the individual RGB components and to intensity becoming non-monotonic. The palette is also affected by set palette gamma. The default values are

set palette cubehelix start 0.5 cycles -1.5 saturation 1
set palette gamma 1.5

File

set palette file is basically a set palette defined (<gradient>) where <gradient> is read from a datafile. Either 4 columns (gray,R,G,B) or just three columns (R,G,B) have to be selected via the using data file modifier. In the three column case, the line number will be used as gray. The gray range is automatically rescaled to [0,1]. The file is read as a normal data file, so all datafile modifiers can be used. Please note, that R might actually be e.g. H if HSV color space is selected.

As usual <filename> may be '-' which means that the data follow the command inline and are terminated by a single e on a line of its own.

Use show palette gradient to display the gradient.

Examples:

Read in a palette of RGB triples each in range [0,255]:

set palette file 'some-palette' using ($1/255):($2/255):($3/255)

Equidistant rainbow (blue-green-yellow-red) palette:

set palette model RGB file "-"
0 0 1
0 1 0
1 1 0
1 0 0
e

Binary palette files are supported as well, see binary general. Example: put 64 triplets of R,G,B doubles into file palette.bin and load it by

set palette file "palette.bin" binary record=64 using 1:2:3

Gamma correction

For gray mappings gamma correction can be turned on by set palette gamma <gamma>. <gamma> defaults to 1.5 which is quite suitable for most terminals.

The gamma correction is applied to the cubehelix color palette family, but not to other palette coloring schemes. However, you may easily implement gamma correction for explicit color functions.

Example:

set palette model RGB
set palette functions gray**0.64, gray**0.67, gray**0.70

To use gamma correction with interpolated gradients specify intermediate gray values with appropriate colors. Instead of

set palette defined ( 0 0 0 0, 1 1 1 1 )

use e.g.

set palette defined ( 0 0 0 0, 0.5 .73 .73 .73, 1 1 1 1 )

or even more intermediate points until the linear interpolation fits the "gamma corrected" interpolation well enough.

Postscript

In order to reduce the size of postscript files, the gray value and not all three calculated r,g,b values are written to the file. Therefore the analytical formulae are coded directly in the postscript language as a header just before the pm3d drawing, see /g and /cF definitions. Usually, it makes sense to write therein definitions of only the 3 formulae used. But for multiplot or any other reason you may want to manually edit the transformations directly in the postscript file. This is the default option nops_allcF. Using the option ps_allcF writes postscript definitions of all formulae. This you may find interesting if you want to edit the postscript file in order to have different palettes for different surfaces in one graph. Well, you can achieve this functionality by multiplot with fixed origin and size.

If you are writing a pm3d surface to a postscript file, it may be possible to reduce the file size by up to 50% by the enclosed awk script pm3dCompress.awk. If the data lies on a rectangular grid, even greater compression may be possible using the script pm3dConvertToImage.awk. Usage:

awk -f pm3dCompress.awk thefile.ps >smallerfile.ps
awk -f pm3dConvertToImage.awk thefile.ps >smallerfile.ps

Pointintervalbox

The pointinterval property of line types is used in plot style linespoints. A negative value of pointinterval, e.g. -N, means that point symbols are drawn only for every Nth point, and that a box (actually circle) behind each point symbol is blanked out by filling with the background color. The command set pointintervalbox controls the radius of this blanked-out region. It is a multiplier for the default radius, which is equal to the point size.

Pointsize

The set pointsize command scales the size of the points used in plots.

Syntax:

set pointsize <multiplier>
show pointsize

The default is a multiplier of 1.0. Larger pointsizes may be useful to make points more visible in bitmapped graphics.

The pointsize of a single plot may be changed on the plot command. See plot with for details.

Please note that the pointsize setting is not supported by all terminal types.

Polar

The set polar command changes the meaning of the plot from rectangular coordinates to polar coordinates.

Syntax:

set polar
unset polar
show polar

In polar coordinates, the dummy variable (t) is an angle. The default range of t is [0:2*pi], or, if degree units have been selected, to [0:360] (see set angles).

The command unset polar changes the meaning of the plot back to the default rectangular coordinate system.

The set polar command is not supported for splots. See the set mapping command for similar functionality for splots.

While in polar coordinates the meaning of an expression in t is really r = f(t), where t is an angle of rotation. The trange controls the domain (the angle) of the function. The r, x and y ranges control the extent of the graph in the x and y directions. Each of these ranges, as well as the rrange, may be autoscaled or set explicitly. For details, see set rrange and set xrange.

Example:

set polar
plot t*sin(t)
set trange [-2*pi:2*pi]
set rrange [0:3]
plot t*sin(t)

The first plot uses the default polar angular domain of 0 to 2*pi. The radius and the size of the graph are scaled automatically. The second plot expands the domain, and restricts the size of the graph to the area within 3 units of the origin. This has the effect of limiting x and y to [-3:3].

You may want to set size square to have gnuplot try to make the aspect ratio equal to unity, so that circles look circular. See also

polar demos (polar.dem)

and

polar data plot (poldat.dem).

Print

The set print command redirects the output of the print command to a file.

Syntax:

set print
set print "-"
set print "<filename>" [append]
set print "|<shell_command>"
set print $datablock [append]

Without "<filename>", the output file is restored to <STDERR>. The <filename> "-" means <STDOUT>. The append flag causes the file to be opened in append mode. A <filename> starting with "|" is opened as a pipe to the <shell_command> on platforms that support piping.

The destination for print commands can also be a named data block. Data block names start with '$', see also inline data.

Psdir

The set psdir <directory> command controls the search path used by the postscript terminal to find prologue.ps and character encoding files. You can use this mechanism to switch between different sets of locally-customized prolog files. The search order is

1) The directory specified by `set psdir`, if any
2) The directory specified by environmental variable GNUPLOT_PS_DIR
3) A built-in header or one from the default system directory
4) Directories set by `set loadpath`

Raxis

The commands set raxis and unset raxis toggle whether the polar axis is drawn separately from grid lines and the x axis. If the minimum of the current rrange is non-zero (and not autoscaled), then a white circle is drawn at the center of the polar plot to indicate that the plot lines and axes do not reach 0. The axis line is drawn using the same line type as the plot border. See polar, rrange, rtics, set grid.

Rmargin

The command set rmargin sets the size of the right margin. Please see set margin for details.

Rrange

The set rrange command sets the range of the radial coordinate for a graph in polar mode. This has the effect of setting both xrange and yrange as well. The resulting xrange and yrange are both [-(rmax-rmin) : +(rmax-rmin)]. However if you later change the x or y range, for example by zooming, this does not change rrange, so data points continue to be clipped against rrange. Autoscaling of rmin always results in rmin = 0. Note: Setting a negative value for rmin may produce unexpected results.

Rtics

The set rtics command places tics along the polar axis. These will only be shown in polar plot mode. The tics and labels are drawn to the right of the origin. The mirror keyword causes them to be drawn also to the left of the origin. See polar, set xtics, and set mxtics for discussion of keywords.

Samples

The default sampling rate of functions, or for interpolating data, may be changed by the set samples command. To change the sampling range for a particular plot, see plot sampling.

Syntax:

set samples <samples_1> {,<samples_2>}
show samples

By default, sampling is set to 100 points. A higher sampling rate will produce more accurate plots, but will take longer. This parameter has no effect on data file plotting unless one of the interpolation/approximation options is used. See plot smooth re 2D data and set cntrparam and set dgrid3d re 3D data.

When a 2D graph is being done, only the value of <samples_1> is relevant.

When a surface plot is being done without the removal of hidden lines, the value of samples specifies the number of samples that are to be evaluated for the isolines. Each iso-v line will have <sample_1> samples and each iso-u line will have <sample_2> samples. If you only specify <samples_1>, <samples_2> will be set to the same value as <samples_1>. See also set isosamples.

Size

Syntax:

set size {{no}square | ratio <r> | noratio} {<xscale>,<yscale>}
show size

The <xscale> and <yscale> values are scale factors for the size of the plot, which includes the graph, labels, and margins.

Important note:

In earlier versions of gnuplot, some terminal types used the values from
`set size` to control also the size of the output canvas; others did not.
Almost all terminals now follow the following convention:

set term <terminal_type> size <XX>, <YY> controls the size of the output file, or canvas. Please see individual terminal documentation for allowed values of the size parameters. By default, the plot will fill this canvas.

set size <XX>, <YY> scales the plot itself relative to the size of the canvas. Scale values less than 1 will cause the plot to not fill the entire canvas. Scale values larger than 1 will cause only a portion of the plot to fit on the canvas. Please be aware that setting scale values larger than 1 may cause problems on some terminal types.

ratio causes gnuplot to try to create a graph with an aspect ratio of <r> (the ratio of the y-axis length to the x-axis length) within the portion of the plot specified by <xscale> and <yscale>.

The meaning of a negative value for <r> is different. If <r>=-1, gnuplot tries to set the scales so that the unit has the same length on both the x and y axes. This is equivalent to set view equal xy. See set view equal. If <r>=-2, the unit on y has twice the length of the unit on x, and so on.

The success of gnuplot in producing the requested aspect ratio depends on the terminal selected. The graph area will be the largest rectangle of aspect ratio <r> that will fit into the specified portion of the output (leaving adequate margins, of course).

set size square is a synonym for set size ratio 1.

Both noratio and nosquare return the graph to the default aspect ratio of the terminal, but do not return <xscale> or <yscale> to their default values (1.0).

ratio and square have no effect on 3D plots, but do affect 3D projections created using set view map. See also set view equal, which forces the x and y axes of a 3D onto the same scale.

Examples:

To set the size so that the plot fills the available canvas:

set size 1,1

To make the graph half size and square use:

set size square 0.5,0.5

To make the graph twice as high as wide use:

set size ratio 2

Style

Default plotting styles are chosen with the set style data and set style function commands. See plot with for information about how to override the default plotting style for individual functions and data sets. See plotting styles for a complete list of styles.

Syntax:

set style function <style>
set style data <style>
show style function
show style data

Default styles for specific plotting elements may also be set.

Syntax:

set style arrow <n> <arrowstyle>
set style boxplot <boxplot style options>
set style circle radius <size> {clip|noclip}
set style ellipse size <size> units {xy|xx|yy} {clip|noclip}
set style fill <fillstyle>
set style histogram <histogram style options>
set style line <n> <linestyle>
set style rectangle <object options> <linestyle> <fillstyle>
set style textbox {opaque|transparent} {{no}border}

Set style arrow

Each terminal has a default set of arrow and point types, which can be seen by using the command test. set style arrow defines a set of arrow types and widths and point types and sizes so that you can refer to them later by an index instead of repeating all the information at each invocation.

Syntax:

set style arrow <index> default
set style arrow <index> {nohead | head | heads}
                        {size <length>,<angle>{,<backangle>} {fixed}}
                        {filled | empty | nofilled | noborder}
                        {front | back}
                        { {linestyle | ls <line_style>}
                          | {linetype | lt <line_type>}
                            {linewidth | lw <line_width} }
unset style arrow
show style arrow

<index> is an integer that identifies the arrowstyle.

If default is given all arrow style parameters are set to their default values.

If the linestyle <index> already exists, only the given parameters are changed while all others are preserved. If not, all undefined values are set to the default values.

Specifying nohead produces arrows drawn without a head---a line segment. This gives you yet another way to draw a line segment on the plot. By default, arrows have one head. Specifying heads draws arrow heads on both ends of the line.

Head size can be controlled by size <length>,<angle> or size <length>,<angle>,<backangle>, where <length> defines length of each branch of the arrow head and <angle> the angle (in degrees) they make with the arrow. <Length> is in x-axis units; this can be changed by first, second, graph, screen, or character before the <length>; see coordinates for details.

By default the size of the arrow head is reduced for very short arrows. This can be disabled using the fixed keyword after the size command.

<backangle> is the angle (in degrees) the back branches make with the arrow (in the same direction as <angle>). It is ignored if the style is nofilled.

Specifying filled produces filled arrow heads (if heads are used). Specifying noborder draws filled arrow heads but does not draw a line around the arrow head. This has two effects. The arrow head is slightly smaller. The tip of the arrow head lies exactly on the endpoint of the vector. If the border is drawn, the tip extends beyond the endpoint by some fraction of the border linewidth. Not all terminals support filled arrow heads.

The line style may be selected from a user-defined list of line styles (see set style line) or may be defined here by providing values for <line_type> (an index from the default list of styles) and/or <line_width> (which is a multiplier for the default width).

Note, however, that if a user-defined line style has been selected, its properties (type and width) cannot be altered merely by issuing another set style arrow command with the appropriate index and lt or lw.

If front is given, the arrows are written on top of the graphed data. If back is given (the default), the arrow is written underneath the graphed data. Using front will prevent a arrow from being obscured by dense data.

Examples:

To draw an arrow without an arrow head and double width, use:

set style arrow 1 nohead lw 2
set arrow arrowstyle 1

See also set arrow for further examples.

Boxplot

The set style boxplot command allows you to change the layout of plots created using the boxplot plot style.

Syntax:

set style boxplot {range <r> | fraction <f>}
                  {{no}outliers} {pointtype <p>}
                  {candlesticks | financebars}
                  {separation <x>}
                  {labels off | auto | x | x2}
                  {sorted | unsorted}

The box in the boxplot always spans the range of values from the first quartile to the third quartile of the data points. The limit of the whiskers that extend from the box can be controlled in two different ways. By default the whiskers extend from each end of the box for a range equal to 1.5 times the interquartile range (i.e. the vertical height of the box proper). Each whisker is truncated back toward the median so that it terminates at a y value belonging to some point in the data set. Since there may be no point whose value is exactly 1.5 times the interquartile distance, the whisker may be shorter than its nominal range. This default corresponds to

set style boxplot range 1.5

Alternatively, you can specify the fraction of the total number of points that the whiskers should span. In this case the range is extended symmetrically from the median value until it encompasses the requested fraction of the data set. Here again each whisker is constrained to end at a point in the data set. To span 95% of the points in the set

set style boxplot fraction 0.95

Any points that lie outside the range of the whiskers are considered outliers. By default these are drawn as individual circles (pointtype 7). The option nooutliers disables this.

By default boxplots are drawn in a style similar to candlesticks, but you have the option of using instead a style similar to finance bars.

If the using specification for a boxplot contains a fourth column, the values in that column will be interpreted as the discrete leveles of a factor variable. In this case more than one boxplots may be drawn, as many as the number of levels of the factor variable. These boxplots will be drawn next to each other, the distance between them is 1.0 by default (in x-axis units). This distance can be changed by the option separation.

The labels option governs how and where these boxplots (each representing a part of the dataset) are labeled. By default the value of the factor is put as a tick label on the horizontal axis -- x or x2, depending on which one is used for the plot itself. This setting corresponds to option labels auto. The labels can be forced to use either of the x or x2 axes -- options labels x and labels x2, respectively --, or they can be turned off altogether with the option labels off.

By default the boxplots corresponding to different levels of the factor variable are not sorted; they will be drawn in the same order the levels are encountered in the data file. This behavior corresponds to the unsorted option. If the sorted option is active, the levels are first sorted alphabetically, and the boxplots are drawn in the sorted order.

The separation, labels, sorted and unsorted option only have an effect if a fourth column is given the plot specification.

See boxplot, candlesticks, financebars.

Set style data

The set style data command changes the default plotting style for data plots.

Syntax:

set style data <plotting-style>
show style data

See plotting styles for the choices. If no choice is given, the choices are listed. show style data shows the current default data plotting style.

Set style fill

The set style fill command is used to set the default style of the plot elements in plots with boxes, histograms, candlesticks and filledcurves. This default can be superseded by fillstyles attached to individual plots. See also 'set style rectangle'.

Syntax:

set style fill {empty
                | {transparent} solid {<density>}
                | {transparent} pattern {<n>}}
               {border {lt} {lc <colorspec>} | noborder}

The default fillstyle is empty.

The solid option causes filling with a solid color, if the terminal supports that. The <density> parameter specifies the intensity of the fill color. At a <density> of 0.0, the box is empty, at <density> of 1.0, the inner area is of the same color as the current linetype. Some terminal types can vary the density continuously; others implement only a few levels of partial fill. If no <density> parameter is given, it defaults to 1.

The pattern option causes filling to be done with a fill pattern supplied by the terminal driver. The kind and number of available fill patterns depend on the terminal driver. If multiple datasets using filled boxes are plotted, the pattern cycles through all available pattern types, starting from pattern <n>, much as the line type cycles for multiple line plots.

The empty option causes filled boxes not to be filled. This is the default.

By default, border, the box is bounded by a solid line of the current linetype. border <colorspec> allows you to change the color of the border. noborder specifies that no bounding lines are drawn.

Set style fill transparent

Some terminals support the attribute transparent for filled areas. In the case of transparent solid fill areas, the density parameter is interpreted as an alpha value; that is, density 0 is fully transparent, density 1 is fully opaque. In the case of transparent pattern fill, the background of the pattern is either fully transparent or fully opaque.

Terminal solid pattern pm3d
gif no yes no
jpeg yes no yes
pdf yes yes yes
png TrueColor index yes
post no yes no
svg yes yes yes
win yes yes yes
wxt yes yes yes
x11 no yes no

Note that there may be additional limitations on the creation or viewing of graphs containing transparent fill areas. For example, the png terminal can only use transparent fill if the "truecolor" option is set. Some pdf viewers may not correctly display the fill areas even if they are correctly described in the pdf file. Ghostscript/gv does not correctly display pattern-fill areas even though actual PostScript printers generally have no problem.

Set style function

The set style function command changes the default plotting style for function plots (e.g. lines, points, filledcurves). See plotting styles.

Syntax:

set style function <plotting-style>
show style function

Set style increment

Note: This command has been deprecated. Instead please use the newer command set linetype, which redefines the linetypes themselves rather than searching for a suitable temporary line style to substitute. See set linetype

Syntax:

set style increment {default|userstyles}
show style increment

By default, successive plots within the same graph will use successive linetypes from the default set for the current terminal type. However, choosing set style increment user allows you to step through the user-defined line styles rather than through the default linetypes.

Example:

set style line 1 lw 2 lc rgb "gold"
set style line 2 lw 2 lc rgb "purple"
set style line 4 lw 1 lc rgb "sea-green"
set style increment user
plot f1(x), f2(x), f3(x), f4(x)

should plot functions f1, f2, f4 in your 3 newly defined line styles. If a user-defined line style is not found then the corresponding default linetype is used instead. E.g. in the example above, f3(x) will be plotted using the default linetype 3.

Set style line

Each terminal has a default set of line and point types, which can be seen by using the command test. set style line defines a set of line types and widths and point types and sizes so that you can refer to them later by an index instead of repeating all the information at each invocation.

Syntax:

set style line <index> default
set style line <index> {{linetype  | lt} <line_type> | <colorspec>}
                       {{linecolor | lc} <colorspec>}
                       {{linewidth | lw} <line_width>}
                       {{pointtype | pt} <point_type>}
                       {{pointsize | ps} <point_size>}
                       {{pointinterval | pi} <interval>}
                       {palette}
unset style line
show style line

default sets all line style parameters to those of the linetype with that same index.

If the linestyle <index> already exists, only the given parameters are changed while all others are preserved. If not, all undefined values are set to the default values.

Line styles created by this mechanism do not replace the default linetype styles; both may be used. Line styles are temporary. They are lost whenever you execute a reset command. To redefine the linetype itself, please see set linetype.

The line and point types default to the index value. The exact symbol that is drawn for that index value may vary from one terminal type to another.

The line width and point size are multipliers for the current terminal's default width and size (but note that <point_size> here is unaffected by the multiplier given by the commandset pointsize).

The pointinterval controls the spacing between points in a plot drawn with style linespoints. The default is 0 (every point is drawn). For example, set style line N pi 3 defines a linestyle that uses pointtype N, pointsize and linewidth equal to the current defaults for the terminal, and will draw every 3rd point in plots using with linespoints. A negative value for the interval is treated the same as a positive value, except that some terminals will try to interrupt the line where it passes through the point symbol.

Not all terminals support the linewidth and pointsize features; if not supported, the option will be ignored.

Terminal-independent colors may be assigned using either linecolor <colorspec> or linetype <colorspec>, abbreviated lc or lt. This requires giving a RGB color triple, a known palette color name, a fractional index into the current palette, or a constant value from the current mapping of the palette onto cbrange. See colors, colorspec, set palette, colornames, cbrange.

set style line <n> linetype <lt> will set both a terminal-dependent dot/dash pattern and color. The commandsset style line <n> linecolor <colorspec> or set style line <n> linetype <colorspec> will set a new line color while leaving the existing dot-dash pattern unchanged.

In 3d mode (splot command), the special keyword palette is allowed as a shorthand for "linetype palette z". The color value corresponds to the z-value (elevation) of the splot, and varies smoothly along a line or surface.

Examples: Suppose that the default lines for indices 1, 2, and 3 are red, green, and blue, respectively, and the default point shapes for the same indices are a square, a cross, and a triangle, respectively. Then

set style line 1 lt 2 lw 2 pt 3 ps 0.5

defines a new linestyle that is green and twice the default width and a new pointstyle that is a half-sized triangle. The commands

set style function lines
plot f(x) lt 3, g(x) ls 1

will create a plot of f(x) using the default blue line and a plot of g(x) using the user-defined wide green line. Similarly the commands

set style function linespoints
plot p(x) lt 1 pt 3, q(x) ls 1

will create a plot of p(x) using the default triangles connected by a red line and q(x) using small triangles connected by a green line.

splot sin(sqrt(x*x+y*y))/sqrt(x*x+y*y) w l pal

creates a surface plot using smooth colors according to palette. Note, that this works only on some terminals. See also set palette, set pm3d.

set style line 10 linetype 1 linecolor rgb "cyan"

will assign linestyle 10 to be a solid cyan line on any terminal that supports rgb colors.

Set style circle

Syntax:

set style circle {radius {graph|screen} <R>} 
                 {{no}wedge} 
                 {clip|noclip}

This command sets the default radius used in plot style "with circles". It applies to data plots with only 2 columns of data (x,y) and to function plots. The default is "set style circle radius graph 0.02". Nowedge disables drawing of the two radii that connect the ends of an arc to the center. The default is wedge. This parameter has no effect on full circles. Clip clips the circle at the plot boundaries, noclip disables this. Default is clip.

Set style rectangle

Rectangles defined with the set object command can have individual styles. However, if the object is not assigned a private style then it inherits a default that is taken from the set style rectangle command.

Syntax:

set style rectangle {front|back} {lw|linewidth <lw>}
                    {fillcolor <colorspec>} {fs <fillstyle>}

See colorspec and fillstyle. fillcolor may be abbreviated as fc.

Examples:

set style rectangle back fc rgb "white" fs solid 1.0 border lt -1
set style rectangle fc linsestyle 3 fs pattern 2 noborder

The default values correspond to solid fill with the background color and a black border.

Set style ellipse

Syntax:

set style ellipse {units xx|xy|yy}
                  {size {graph|screen} <a>, {{graph|screen} <b>}}
                  {angle <angle>}
                  {clip|noclip}

This command governs whether the diameters of ellipses are interpreted in the same units or not. Default is xy, which means that the major diameter (first axis) of ellipses will be interpreted in the same units as the x (or x2) axis, while the minor (second) diameter in those of the y (or y2) axis. In this mode the ratio of the ellipse axes depends on the scales of the plot axes and aspect ratio of the plot. When set to xx or yy, both axes of all ellipses will be interpreted in the same units. This means that the ratio of the axes of the plotted ellipses will be correct even after rotation, but either their vertical or horizontal extent will not be correct.

This is a global setting that affects all ellipses, both those defined as objects and those generated with the plot command, however, the value of units can also be redefined on a per-plot and per-object basis.

It is also possible to set a default size for ellipses with the size keyword. This default size applies to data plots with only 2 columns of data (x,y) and to function plots. The two values are interpreted as the major and minor diameters (as opposed to semi-major and semi-minor axes) of the ellipse.

The default is "set style ellipse size graph 0.05,0.03".

Last, but not least it is possible to set the default orientation with the angle keyword. The orientation, which is defined as the angle between the major axis of the ellipse and the plot's x axis, must be given in degrees.

Clip clips the ellipse at the plot boundaries, noclip disables this. Default is clip.

For defining ellipse objects, see set object ellipse; for the 2D plot style, see ellipses.

Set style textbox

Syntax: set style textbox {opaque|transparent}{{no}border}

This command controls the appearance of labels with the attribute 'boxed'. Terminal types that do not support boxed text will ignore this style.

Surface

The set surface command is only relevant for 3D plots (splot).

Syntax:

set surface {implicit|explicit}
unset surface
show surface

unset surface will cause splot to not draw points or lines corresponding to any of the function or data file points. This is mainly useful for drawing only contour lines rather than the surface they were derived from. Contours may still be drawn on the surface, depending on the set contour option. To turn off the surface for an individual function or data file while leaving others active, use the nosurface keyword in the splot command. The combination unset surface; set contour base is useful for displaying contours on the grid base. See also set contour.

If an 3D data set is recognizable as a mesh (grid) then by default the program implicitly treats the plot style with lines as requesting a gridded surface. See grid_data. The command set surface explicit suppresses this expansion, plotting only the individual lines described by separate datablocks in the input file. A gridded surface can still be plotted by explicitly requesting splot with surface.

Table

When table mode is enabled, plot and splot commands print out a multicolumn text table of X Y {Z} R values rather than creating an actual plot on the current terminal. The character R takes on one of three values: "i" if the point is in the active range, "o" if it is out-of-range, or "u" if it is undefined. The data format is determined by the format of the axis tickmarks (see set format), and the columns are separated by single spaces. This can be useful if you want to generate contours and then save them for further use. The same method can be used to save interpolated data (see set samples and set dgrid3d).

Syntax:

set table {"outfile" | $datablock}
plot <whatever>
unset table

Tabular output is written to the named file, if any, otherwise it is written to the current value of set output. Alternatively, tabular output can be redirected to a named data block. Data block names start with '$', see also inline data. You must explicitly unset table in order to go back to normal plotting on the current terminal.

To avoid any style-dependent processing of the input data (smoothing, errorbar expansion, secondary range checking, etc), or to increase the number of columns that can be tabulated, you can use the keyword "table" instead of a normal plot style. For example

set table
plot <file> using 1:2:3:4:5:6:7:8:9:10 with table

Terminal

gnuplot supports many different graphics devices. Use set terminal to tell gnuplot what kind of output to generate. Use set output to redirect that output to a file or device.

Syntax:

set terminal {<terminal-type> | push | pop}
show terminal

If <terminal-type> is omitted, gnuplot will list the available terminal types. <terminal-type> may be abbreviated.

If both set terminal and set output are used together, it is safest to give set terminal first, because some terminals set a flag which is needed in some operating systems.

Some terminals have many additional options. The options used by a previous invocation set term <term> <options> of a given <term> are remembered, thus subsequent set term <term> does not reset them. This helps in printing, for instance, when switching among different terminals---previous options don't have to be repeated.

The command set term push remembers the current terminal including its settings while set term pop restores it. This is equivalent to save term and load term, but without accessing the filesystem. Therefore they can be used to achieve platform independent restoring of the terminal after printing, for instance. After gnuplot's startup, the default terminal or that from startup file is pushed automatically. Therefore portable scripts can rely that set term pop restores the default terminal on a given platform unless another terminal has been pushed explicitly.

For more information, see the complete list of terminals.

Termoption

The set termoption command allows you to change the behaviour of the current terminal without requiring a new set terminal command. Only one option can be changed per command, and only a small number of options can be changed this way. Currently the only options accepted are

set termoption {no}enhanced
set termoption font "<fontname>{,<fontsize>}"
set termoption fontscale <scale>
set termoption {solid|dashed}
set termoption {linewidth <lw>}{lw <lw>}

Tics

Control of the labeled tics on all axes at once is possible with the set tics command.

The tics may be turned off with the unset tics command, and may be turned on (the default state) with set tics. Fine control of tics on individual axes is possible using the alternative commands set xtics, set ztics, etc.

Syntax:

set tics {axis | border} {{no}mirror}
         {in | out} {front | back}
         {{no}rotate {by <ang>}} {offset <offset> | nooffset}
         {left | right | center | autojustify}
         { format "formatstring" } { font "name{,<size>}" }
         { textcolor <colorspec> }
set tics scale {default | <major> {,<minor>}}
unset tics
show tics

The options can be applied to a single axis (x, y, z, x2, y2, cb), e.g.

set xtics rotate by -90
unset cbtics

Set tics front or back applies to all axes at once, but only for 2D plots (not splot). It controls whether the tics are placed behind or in front of the plot elements, in the case that there is overlap.

axis or border tells gnuplot to put the tics (both the tics themselves and the accompanying labels) along the axis or the border, respectively. If the axis is very close to the border, the axis option will move the tic labels to outside the border in case the border is printed (see set border). The relevant margin settings will usually be sized badly by the automatic layout algorithm in this case.

mirror tells gnuplot to put unlabeled tics at the same positions on the opposite border. nomirror does what you think it does.

in and out change the tic marks to be drawn inwards or outwards.

set tics scale controls the size of the tic marks. The first value <major> controls the auto-generated or user-specified major tics (level 0). The second value controls the auto-generated or user-specified minor tics (level 1). <major> defaults to 1.0, <minor> defaults to <major>/2. Additional values control the size of user-specified tics with level 2, 3, ... Default tic sizes are restored by set tics scale default.

rotate asks gnuplot to rotate the text through 90 degrees, which will be done if the terminal driver in use supports text rotation. norotate cancels this. rotate by <ang> asks for rotation by <ang> degrees, supported by some terminal types.

The defaults are border mirror norotate for tics on the x and y axes, and border nomirror norotate for tics on the x2 and y2 axes. For the z axis, the default is nomirror.

The <offset> is specified by either x,y or x,y,z, and may be preceded by first, second, graph, screen, or character to select the coordinate system. <offset> is the offset of the tics texts from their default positions, while the default coordinate system is character. See coordinates for details. nooffset switches off the offset.

By default, tic labels are justified automatically depending on the axis and rotation angle to produce aesthetically pleasing results. If this is not desired, justification can be overridden with an explicit left, right or center keyword. autojustify restores the default behavior.

set tics with no options restores to place tics inwards. Every other options are retained.

See also set xtics for more control of major (labeled) tic marks and set mxtics for control of minor tic marks. These commands provide control of each axis independently.

Ticslevel

Deprecated. See set xyplane.

Ticscale

The set ticscale command is deprecated, use set tics scale instead.

Timestamp

The command set timestamp places the time and date of the plot in the left margin.

Syntax:

set timestamp {"<format>"} {top|bottom} {{no}rotate}
              {offset <xoff>{,<yoff>}} {font "<fontspec>"}
              {textcolor <colorspec>}
unset timestamp
show timestamp

The format string allows you to choose the format used to write the date and time. Its default value is what asctime() uses: "%a %b %d %H:%M:%S %Y" (weekday, month name, day of the month, hours, minutes, seconds, four-digit year). With top or bottom you can place the timestamp at the top or bottom of the left margin (default: bottom). rotate lets you write the timestamp vertically, if your terminal supports vertical text. The constants <xoff> and <yoff> are offsets that let you adjust the position more finely. <font> is used to specify the font with which the time is to be written.

The abbreviation time may be used in place of timestamp.

Example:

set timestamp "%d/%m/%y %H:%M" offset 80,-2 font "Helvetica"

See set timefmt for more information about time format strings.

Timefmt

This command applies to timeseries where data are composed of dates/times. It has no meaning unless the command set *data time is given also.

Syntax:

set timefmt {<axis>} "<format string>"
show timefmt

The optional <axis> argument allows to specify different time input formats for individual axes. If it is omitted, the format string is applied to all axes.

The string argument tells gnuplot how to read timedata from the datafile. The valid formats are:

Format Explanation
%d day of the month, 1–31
%m month of the year, 1–12
%y year, 0–99
%Y year, 4-digit
%j day of the year, 1–365
%H hour, 0–24
%M minute, 0–60
%s seconds since the Unix epoch (1970-01-01 00:00 UTC)
%S second, integer 0–60 on output, (double) on input
%b three-character abbreviation of the name of the month
%B name of the month

Any character is allowed in the string, but must match exactly. \t (tab) is recognized. Backslash-octals (\nnn) are converted to char. If there is no separating character between the time/date elements, then %d, %m, %y, %H, %M and %S read two digits each. If a decimal point immediately follows the field read by %S, the decimal and any following digits are interpreted as a fractional second. %Y reads four digits. %j reads three digits. %b requires three characters, and %B requires as many as it needs.

Spaces are treated slightly differently. A space in the string stands for zero or more whitespace characters in the file. That is, "%H %M" can be used to read "1220" and "12 20" as well as "12 20".

Each set of non-blank characters in the timedata counts as one column in the using n:n specification. Thus 11:11 25/12/76 21.0 consists of three columns. To avoid confusion, gnuplot requires that you provide a complete using specification if your file contains timedata.

If the date format includes the day or month in words, the format string must exclude this text. But it can still be printed with the "%a", "%A", "%b", or "%B" specifier. gnuplot will determine the proper month and weekday from the numerical values. See set format for more details about these and other options for printing time data.

When reading two-digit years with %y, values 69-99 refer to the 20th century, while values 00-68 refer to the 21st century. NB: This is in accordance with the UNIX98 spec, but conventions vary widely and two-digit year values are inherently ambiguous.

See also set xdata and time/date for more information.

Example:

set timefmt "%d/%m/%Y\t%H:%M"

tells gnuplot to read date and time separated by tab. (But look closely at your data---what began as a tab may have been converted to spaces somewhere along the line; the format string must match what is actually in the file.) See also

time data demo.

Title

The set title command produces a plot title that is centered at the top of the plot. set title is a special case of set label.

Syntax:

set title {"<title-text>"} {offset <offset>} {font "<font>{,<size>}"}
          {{textcolor | tc} {<colorspec> | default}} {{no}enhanced}
show title

If <offset> is specified by either x,y or x,y,z the title is moved by the given offset. It may be preceded by first, second, graph, screen, or character to select the coordinate system. See coordinates for details. By default, the character coordinate system is used. For example, "set title offset 0,-1" will change only the y offset of the title, moving the title down by roughly the height of one character. The size of a character depends on both the font and the terminal.

<font> is used to specify the font with which the title is to be written; the units of the font <size> depend upon which terminal is used.

textcolor <colorspec> changes the color of the text. <colorspec> can be a linetype, an rgb color, or a palette mapping. See help for colorspec and palette.

noenhanced requests that the title not be processed by the enhanced text mode parser, even if enhanced text mode is currently active.

set title with no parameters clears the title.

See syntax for details about the processing of backslash sequences and the distinction between single- and double-quotes.

Tmargin

The command set tmargin sets the size of the top margin. Please see set margin for details.

Trange

The set trange command sets the parametric range used to compute x and y values when in parametric or polar modes. Please see set xrange for details.

Urange

The set urange and set vrange commands set the parametric ranges used to compute x, y, and z values when in splot parametric mode. Please see set xrange for details.

Variables

The show variables command lists the current value of user-defined and internal variables. Gnuplot internally defines variables whose names begin with GPVAL_, MOUSE_, FIT_, and TERM_.

Syntax:

show variables      # show variables that do not begin with GPVAL_
show variables all  # show all variables including those beginning GPVAL_
show variables NAME # show only variables beginning with NAME

Version

The show version command lists the version of gnuplot being run, its last modification date, the copyright holders, and email addresses for the FAQ, the gnuplot-info mailing list, and reporting bugs--in short, the information listed on the screen when the program is invoked interactively.

Syntax:

show version {long}

When the long option is given, it also lists the operating system, the compilation options used when gnuplot was installed, the location of the help file, and (again) the useful email addresses.

View

The set view command sets the viewing angle for splots. It controls how the 3D coordinates of the plot are mapped into the 2D screen space. It provides controls for both rotation and scaling of the plotted data, but supports orthographic projections only. It supports both 3D projection or orthogonal 2D projection into a 2D plot-like map.

Syntax:

set view <rot_x>{,{<rot_z>}{,{<scale>}{,<scale_z>}}}
set view map {scale <scale>}
set view {no}equal {xy|xyz}
show view

where <rot_x> and <rot_z> control the rotation angles (in degrees) in a virtual 3D coordinate system aligned with the screen such that initially (that is, before the rotations are performed) the screen horizontal axis is x, screen vertical axis is y, and the axis perpendicular to the screen is z. The first rotation applied is <rot_x> around the x axis. The second rotation applied is <rot_z> around the new z axis.

Command set view map is used to represent the drawing as a map. It is useful for contour plots or 2D heatmaps using pm3d mode rather than with image. In the latter case, take care that you properly use zrange and cbrange for input data point filtering and color range scaling, respectively.

<rot_x> is bounded to the [0:180] range with a default of 60 degrees, while <rot_z> is bounded to the [0:360] range with a default of 30 degrees. <scale> controls the scaling of the entire splot, while <scale_z> scales the z axis only. Both scales default to 1.0.

Examples:

set view 60, 30, 1, 1
set view ,,0.5

The first sets all the four default values. The second changes only scale, to 0.5.

Equal_axes

The command set view equal xy forces the unit length of the x and y axes to be on the same scale, and chooses that scale so that the plot will fit on the page. The command set view equal xyz additionally sets the z axis scale to match the x and y axes; however there is no guarantee that the current z axis range will fit within the plot boundary. By default all three axes are scaled independently to fill the available area.

See also set xyplane.

Vrange

The set urange and set vrange commands set the parametric ranges used to compute x, y, and z values when in splot parametric mode. Please see set xrange for details.

X2data

The set x2data command sets data on the x2 (top) axis to timeseries (dates/times). Please see set xdata.

X2dtics

The set x2dtics command changes tics on the x2 (top) axis to days of the week. Please see set xdtics for details.

X2label

The set x2label command sets the label for the x2 (top) axis. Please see set xlabel.

X2mtics

The set x2mtics command changes tics on the x2 (top) axis to months of the year. Please see set xmtics for details.

X2range

The set x2range command sets the horizontal range that will be displayed on the x2 (top) axis. See set xrange for the full set of command options. This command is ignored if the x2 axis range is explicitly linked to the x axis. See set link.

X2tics

The set x2tics command controls major (labeled) tics on the x2 (top) axis. Please see set xtics for details.

X2zeroaxis

The set x2zeroaxis command draws a line at the origin of the x2 (top) axis (y2 = 0). For details, please see set zeroaxis.

Xdata

This command controls interpretation of data on the x axis. An analogous command acts on each of the other axes.

Syntax:

set xdata {time | geographic}
show xdata

The same syntax applies to ydata, zdata, x2data, y2data and cbdata.

The time option signals that data represents a time/date in seconds. The current version of gnuplot stores time to a millisecond precision.

The geographic option signals that data represents a geographical coordinate measured in degrees/minutes/seconds.

If no option is specified, the data interpretation reverts to normal.

Time

set xdata time indicates that the x coordinate is to be interpreted as a date or time to millisecond precision.

See set timefmt to tell gnuplot how to read date or time data from a file. The time/date is converted to seconds from start of the century. There is currently only one timefmt, which implies that all the time/date columns must conform to this format. Specification of ranges should be supplied as quoted strings according to this format to avoid interpretation of the time/date as an expression.

By default the function 'strftime' (type "man strftime" on unix to look it up) is used to label axis tickmarks. gnuplot tries to figure out a reasonable format for this. You can customize the label format using set format x. See time_specifiers for a special set of time format specifiers. See also time/date for more information.

Geographic

set xdata geographic indicates that the x coordinate is to be interpreted as a geographic coordinate measured in degrees. Use set format x to establish how the coordinate appears as an axis tick label. The format specifiers for geographic data are as follows:

%D                   = integer degrees
%<width.precision>d  = floating point degrees
%M                   = integer minutes
%<width.precision>m  = floating point minutes
%S                   = integer seconds
%<width.precision>s  = floating point seconds
%E                   = label with E/W instead of +/-
%N                   = label with N/S instead of +/-

For example, the command set format x "%Ddeg %5.2mmin %E" will cause x coordinate -1.51 to be labeled as " 1deg 30.60min W".

If no special format is provided, the coordinate will be reported as a decimal number of degrees.

Xdtics

The set xdtics commands converts the x-axis tic marks to days of the week where 0=Sun and 6=Sat. Overflows are converted modulo 7 to dates. set noxdtics returns the labels to their default values. Similar commands do the same things for the other axes.

Syntax:

set xdtics
unset xdtics
show xdtics

The same syntax applies to ydtics, zdtics, x2dtics, y2dtics and cbdtics.

See also the set format command.

Xlabel

The set xlabel command sets the x axis label. Similar commands set labels on the other axes.

Syntax:

set xlabel {"<label>"} {offset <offset>} {font "<font>{,<size>}"}
           {textcolor <colorspec>} {{no}enhanced}
           {rotate by <degrees> | rotate parallel | norotate}
show xlabel

The same syntax applies to x2label, ylabel, y2label, zlabel and cblabel.

If <offset> is specified by either x,y or x,y,z the label is moved by the given offset. It may be preceded by first, second, graph, screen, or character to select the coordinate system. See coordinates for details. By default, the character coordinate system is used. For example, "set xlabel offset -1,0" will change only the x offset of the title, moving the label roughly one character width to the left. The size of a character depends on both the font and the terminal.

<font> is used to specify the font in which the label is written; the units of the font <size> depend upon which terminal is used.

noenhanced requests that the label text not be processed by the enhanced text mode parser, even if enhanced text mode is currently active.

To clear a label, put no options on the command line, e.g., "set y2label".

The default positions of the axis labels are as follows:

xlabel: The x-axis label is centered below the bottom of the plot.

ylabel: The y-axis label is centered to the left of the plot, defaulting to either horizontal or vertical orientation depending on the terminal type.

zlabel: The z-axis label is centered along the z axis and placed in the space above the grid level.

cblabel: The color box axis label is centered along the box and placed below or to the right according to horizontal or vertical color box gradient.

y2label: The y2-axis label is placed to the right of the y2 axis. The position is terminal-dependent in the same manner as is the y-axis label.

x2label: The x2-axis label is placed above the plot but below the title. It is also possible to create an x2-axis label by using new-line characters to make a multi-line plot title, e.g.,

set title "This is the title\n\nThis is the x2label"

Note that double quotes must be used. The same font will be used for both lines, of course.

The orientation (rotation angle) of the x, x2, y and y2 axis labels in 2D plots can be changed by specifying rotate by <degrees>. The orientation of the x and y axis labels in 3D plots defaults to horizontal but can be changed to run parallel to the axis by specifying rotate parallel.

If you are not satisfied with the default position of an axis label, use set label instead--that command gives you much more control over where text is placed.

Please see syntax for further information about backslash processing and the difference between single- and double-quoted strings.

Xmtics

The set xmtics command converts the x-axis tic marks to months of the year where 1=Jan and 12=Dec. Overflows are converted modulo 12 to months. The tics are returned to their default labels by unset xmtics. Similar commands perform the same duties for the other axes.

Syntax:

set xmtics
unset xmtics
show xmtics

The same syntax applies to x2mtics, ymtics, y2mtics, zmtics and cbmtics.

See also the set format command.

Xrange

The set xrange command sets the horizontal range that will be displayed. A similar command exists for each of the other axes, as well as for the polar radius r and the parametric variables t, u, and v.

Syntax:

set xrange [{{<min>}:{<max>}}] {{no}reverse} {{no}writeback} {{no}extend}
           | restore
show xrange

where <min> and <max> terms are constants, expressions or an asterisk to set autoscaling. If the data are time/date, you must give the range as a quoted string according to the set timefmt format. If <min> or <max> is omitted the current value will not be changed. See below for full autoscaling syntax. See also noextend.

The same syntax applies to yrange, zrange, x2range, y2range, cbrange, rrange, trange, urange and vrange.

See set link for options that link the ranges of x and x2, or y and y2.

The reverse option reverses the direction of an autoscaled axis. For example, if the data values range from 10 to 100, it will autoscale to the equivalent of set xrange [100:10]. The reverse flag has no effect if the axis is not autoscaled. NB: This is a change introduced in version 4.7.

Autoscaling: If <min> (the same applies for correspondingly to <max>) is an asterisk "*" autoscaling is turned on. The range in which autoscaling is being performed may be limited by a lower bound <lb> or an upper bound <ub> or both. The syntax is

{ <lb> < } * { < <ub> }

For example,

0 < * < 200

sets <lb> = 0 and <ub> = 200. With such a setting <min> would be autoscaled, but its final value will be between 0 and 200 (both inclusive despite the '<' sign). If no lower or upper bound is specified, the '<' to also be omitted. If <ub> is lower than <lb> the constraints will be turned off and full autoscaling will happen. This feature is useful to plot measured data with autoscaling but providing a limit on the range, to clip outliers, or to guarantee a minimum range that will be displayed even if the data would not need such a big range.

The writeback option essentially saves the range found by autoscale in the buffers that would be filled by set xrange. This is useful if you wish to plot several functions together but have the range determined by only some of them. The writeback operation is performed during the plot execution, so it must be specified before that command. To restore, the last saved horizontal range use set xrange restore. For example,

set xrange [-10:10]
set yrange [] writeback
plot sin(x)
set yrange restore
replot x/2

results in a yrange of [-1:1] as found only from the range of sin(x); the [-5:5] range of x/2 is ignored. Executing show yrange after each command in the above example should help you understand what is going on.

In 2D, xrange and yrange determine the extent of the axes, trange determines the range of the parametric variable in parametric mode or the range of the angle in polar mode. Similarly in parametric 3D, xrange, yrange, and zrange govern the axes and urange and vrange govern the parametric variables.

In polar mode, rrange determines the radial range plotted. <rmin> acts as an additive constant to the radius, whereas <rmax> acts as a clip to the radius---no point with radius greater than <rmax> will be plotted. xrange and yrange are affected---the ranges can be set as if the graph was of r(t)-rmin, with rmin added to all the labels.

Any range may be partially or totally autoscaled, although it may not make sense to autoscale a parametric variable unless it is plotted with data.

Ranges may also be specified on the plot command line. A range given on the plot line will be used for that single plot command; a range given by a set command will be used for all subsequent plots that do not specify their own ranges. The same holds true for splot.

Examples:

To set the xrange to the default:

set xrange [-10:10]

To set the yrange to increase downwards:

set yrange [10:-10]

To change zmax to 10 without affecting zmin (which may still be autoscaled):

set zrange [:10]

To autoscale xmin while leaving xmax unchanged:

set xrange [*:]

To autoscale xmin but keeping xmin positive:

set xrange [0<*:]

To autoscale x but keep minimum range of 10 to 50 (actual might be larger):

set xrange [*<10:50<*]

Autoscaling but limit maximum xrange to -1000 to 1000, i.e. autoscaling within [-1000:1000]

set xrange [-1000<*:*<1000]

Make sure xmin is somewhere between -200 and 100:

set xrange [-200<*<100:]

Xtics

Fine control of the major (labeled) tics on the x axis is possible with the set xtics command. The tics may be turned off with the unset xtics command, and may be turned on (the default state) with set xtics. Similar commands control the major tics on the y, z, x2 and y2 axes.

Syntax:

set xtics {axis | border} {{no}mirror}
          {in | out} {scale {default | <major> {,<minor>}}}
          {{no}rotate {by <ang>}} {offset <offset> | nooffset}
          {left | right | center | autojustify}
          {add}
          {  autofreq
           | <incr>
           | <start>, <incr> {,<end>}
           | ({"<label>"} <pos> {<level>} {,{"<label>"}...) }
          { format "formatstring" } { font "name{,<size>}" }
          { rangelimited }
          { textcolor <colorspec> }
unset xtics
show xtics

The same syntax applies to ytics, ztics, x2tics, y2tics and cbtics.

axis or border tells gnuplot to put the tics (both the tics themselves and the accompanying labels) along the axis or the border, respectively. If the axis is very close to the border, the axis option will move the tic labels to outside the border. The relevant margin settings will usually be sized badly by the automatic layout algorithm in this case.

mirror tells gnuplot to put unlabeled tics at the same positions on the opposite border. nomirror does what you think it does.

in and out change the tic marks to be drawn inwards or outwards.

With scale, the size of the tic marks can be adjusted. If <minor> is not specified, it is 0.5*<major>. The default size 1.0 for major tics and 0.5 for minor tics is requested by scale default.

rotate asks gnuplot to rotate the text through 90 degrees, which will be done if the terminal driver in use supports text rotation. norotate cancels this. rotate by <ang> asks for rotation by <ang> degrees, supported by some terminal types.

The defaults are border mirror norotate for tics on the x and y axes, and border nomirror norotate for tics on the x2 and y2 axes. For the z axis, the {axis | border} option is not available and the default is nomirror. If you do want to mirror the z-axis tics, you might want to create a bit more room for them with set border.

The <offset> is specified by either x,y or x,y,z, and may be preceded by first, second, graph, screen, or character to select the coordinate system. <offset> is the offset of the tics texts from their default positions, while the default coordinate system is character. See coordinates for details. nooffset switches off the offset.

Example:

Move xtics more closely to the plot.

set xtics offset 0,graph 0.05

By default, tic labels are justified automatically depending on the axis and rotation angle to produce aesthetically pleasing results. If this is not desired, justification can be overridden with an explicit left, right or center keyword. autojustify restores the default behavior.

set xtics with no options restores the default border or axis if xtics are being displayed; otherwise it has no effect. Any previously specified tic frequency or position {and labels} are retained.

Positions of the tics are calculated automatically by default or if the autofreq option is given; otherwise they may be specified in either of two forms:

The implicit <start>, <incr>, <end> form specifies that a series of tics will be plotted on the axis between the values <start> and <end> with an increment of <incr>. If <end> is not given, it is assumed to be infinity. The increment may be negative. If neither <start> nor <end> is given, <start> is assumed to be negative infinity, <end> is assumed to be positive infinity, and the tics will be drawn at integral multiples of <incr>. If the axis is logarithmic, the increment will be used as a multiplicative factor.

If you specify to a negative <start> or <incr> after a numerical value (e.g., rotate by <angle> or offset <offset>), the parser fails because it subtracts <start> or <incr> from that value. As a workaround, specify 0-<start> resp. 0-<incr> in that case.

Example:

set xtics border offset 0,0.5 -5,1,5

Fails with 'invalid expression' at the last comma.

set xtics border offset 0,0.5 0-5,1,5

or

set xtics offset 0,0.5 border -5,1,5

Sets tics at the border, tics text with an offset of 0,0.5 characters, and sets the start, increment, and end to -5, 1, and 5, as requested.

The set grid options 'front', 'back' and 'layerdefault' affect the drawing order of the xtics, too.

Examples:

Make tics at 0, 0.5, 1, 1.5, ..., 9.5, 10.

set xtics 0,.5,10

Make tics at ..., -10, -5, 0, 5, 10, ...

set xtics 5

Make tics at 1, 100, 1e4, 1e6, 1e8.

set logscale x; set xtics 1,100,1e8

The explicit ("<label>" <pos> <level>, ...) form allows arbitrary tic positions or non-numeric tic labels. In this form, the tics do not need to be listed in numerical order. Each tic has a position, optionally with a label. Note that the label is a string enclosed by quotes. It may be a constant string, such as "hello", may contain formatting information for converting the position into its label, such as "%3f clients", or may be empty, "". See set format for more information. If no string is given, the default label (numerical) is used.

An explicit tic mark has a third parameter, the level. The default is level 0, a major tic. Level 1 generates a minor tic. Labels are never printed for minor tics. Major and minor tics may be auto-generated by the program or specified explicitly by the user. Tics with level 2 and higher must be explicitly specified by the user, and take priority over auto-generated tics. The size of tics marks at each level is controlled by the command set tics scale.

Examples:

set xtics ("low" 0, "medium" 50, "high" 100)
set xtics (1,2,4,8,16,32,64,128,256,512,1024)
set ytics ("bottom" 0, "" 10, "top" 20)
set ytics ("bottom" 0, "" 10 1, "top" 20)

In the second example, all tics are labeled. In the third, only the end tics are labeled. In the fourth, the unlabeled tic is a minor tic.

Normally if explicit tics are given, they are used instead of auto-generated tics. Conversely if you specify set xtics auto or the like it will erase any previously specified explicit tics. You can mix explicit and auto- generated tics by using the keyword add, which must appear before the tic style being added.

Example:

set xtics 0,.5,10
set xtics add ("Pi" 3.14159)

This will automatically generate tic marks every 0.5 along x, but will also add an explicit labeled tic mark at pi.

However they are specified, tics will only be plotted when in range.

Format (or omission) of the tic labels is controlled by set format, unless the explicit text of a label is included in the set xtics ("<label>") form.

Minor (unlabeled) tics can be added automatically by the set mxtics command, or at explicit positions by the set xtics ("" <pos> 1, ...) form.

Xtics time_data

In case of timeseries data, axis tic position values must be given as quoted dates or times according to the format timefmt. If the <start>, <incr>, <end> form is used, <start> and <end> must be given according to timefmt, but <incr> must be in seconds. Times will be written out according to the format given on set format, however.

Examples:

set xdata time
set timefmt "%d/%m"
set xtics format "%b %d"
set xrange ["01/12":"06/12"]
set xtics "01/12", 172800, "05/12"
set xdata time
set timefmt "%d/%m"
set xtics format "%b %d"
set xrange ["01/12":"06/12"]
set xtics ("01/12", "" "03/12", "05/12")

Both of these will produce tics "Dec 1", "Dec 3", and "Dec 5", but in the second example the tic at "Dec 3" will be unlabeled.

Xtics rangelimited

This option limits both the auto-generated axis tic labels and the corresponding plot border to the range of values actually present in the data that has been plotted. Note that this is independent of the current range limits for the plot. For example, suppose that the data in "file.dat" all lies in the range 2 < y < 4. Then the following commands will create a plot for which the left-hand plot border (y axis) is drawn for only this portion of the total y range, and only the axis tics in this region are generated. I.e., the plot will be scaled to the full range on y, but there will be a gap between 0 and 2 on the left border and another gap between 4 and 10. This style is sometimes referred to as a range-frame graph.

set border 3
set yrange [0:10]
set ytics nomirror rangelimited
plot "file.dat"

Xyplane

The set xyplane command adjusts the position at which the xy plane is drawn in a 3D plot. The synonym "set ticslevel" is accepted for backwards compatibility.

Syntax:

set xyplane at <zvalue>
set xyplane relative <frac>
set ticslevel <frac>        # equivalent to set xyplane relative
show xyplane

The form set xyplane relative <frac> places the xy plane below the range in Z, where the distance from the xy plane to Zmin is given as a fraction of the total range in z. The default value is 0.5. Negative values are permitted, but tic labels on the three axes may overlap. The older, deprecated, form set ticslevel is retained for backwards compatibility.

To place the xy-plane at a position 'pos' on the z-axis, ticslevel may be set equal to (pos - zmin) / (zmin - zmax). However, this position will change if the z range is changed.

The alternative form set xyplane at <zvalue> fixes the placement of the xy plane at a specific Z value regardless of the current z range. Thus to force the x, y, and z axes to meet at a common origin one would specify set xyplane at 0.

See also set view, and set zeroaxis.

Xzeroaxis

The set xzeroaxis command draws a line at y = 0. For details, please see set zeroaxis.

Y2data

The set y2data command sets y2 (right-hand) axis data to timeseries (dates/times). Please see set xdata.

Y2dtics

The set y2dtics command changes tics on the y2 (right-hand) axis to days of the week. Please see set xdtics for details.

Y2label

The set y2label command sets the label for the y2 (right-hand) axis. Please see set xlabel.

Y2mtics

The set y2mtics command changes tics on the y2 (right-hand) axis to months of the year. Please see set xmtics for details.

Y2range

The set y2range command sets the vertical range that will be displayed on the y2 (right) axis. See set xrange for the full set of command options. This command is ignored if the y2 axis range is explicitly linked to the y axis. See set link.

Y2tics

The set y2tics command controls major (labeled) tics on the y2 (right-hand) axis. Please see set xtics for details.

Y2zeroaxis

The set y2zeroaxis command draws a line at the origin of the y2 (right-hand) axis (x2 = 0). For details, please see set zeroaxis.

Ydata

The set ydata commands sets y-axis data to timeseries (dates/times). Please see set xdata.

Ydtics

The set ydtics command changes tics on the y axis to days of the week. Please see set xdtics for details.

Ylabel

This command sets the label for the y axis. Please see set xlabel.

Ymtics

The set ymtics command changes tics on the y axis to months of the year. Please see set xmtics for details.

Yrange

The set yrange command sets the vertical range that will be displayed on the y axis. Please see set xrange for details.

Ytics

The set ytics command controls major (labeled) tics on the y axis. Please see set xtics for details.

Yzeroaxis

The set yzeroaxis command draws a line at x = 0. For details, please see set zeroaxis.

Zdata

The set zdata command sets zaxis data to timeseries (dates/times). Please see set xdata.

Zdtics

The set zdtics command changes tics on the z axis to days of the week. Please see set xdtics for details.

Zzeroaxis

The set zzeroaxis command draws a line through (x=0,y=0). This has no effect on 2D plots, including splot with set view map. For details, please see set zeroaxis and set xyplane.

Cbdata

Set color box axis data to timeseries (dates/times). Please see set xdata.

Cbdtics

The set cbdtics command changes tics on the color box axis to days of the week. Please see set xdtics for details.

Zero

The zero value is the default threshold for values approaching 0.0.

Syntax:

set zero <expression>
show zero

gnuplot will not plot a point if its imaginary part is greater in magnitude than the zero threshold. This threshold is also used in various other parts of gnuplot as a (crude) numerical-error threshold. The default zero value is 1e-8. zero values larger than 1e-3 (the reciprocal of the number of pixels in a typical bitmap display) should probably be avoided, but it is not unreasonable to set zero to 0.0.

Zeroaxis

The x axis may be drawn by set xzeroaxis and removed by unset xzeroaxis. Similar commands behave similarly for the y, x2, y2, and z axes. set zeroaxis ... (no prefix) acts on the x, y, and z axes jointly.

Syntax:

set {x|x2|y|y2|z}zeroaxis { {linestyle | ls <line_style>}
                           | { linetype | lt <line_type>}
                             { linewidth | lw <line_width>}}
unset {x|x2|y|y2|z}zeroaxis
show {x|y|z}zeroaxis

By default, these options are off. The selected zero axis is drawn with a line of type <line_type> and width <line_width> (if supported by the terminal driver currently in use), or a user-defined style <line_style>.

If no linetype is specified, any zero axes selected will be drawn using the axis linetype (linetype 0).

Examples:

To simply have the y=0 axis drawn visibly:

set xzeroaxis

If you want a thick line in a different color or pattern, instead:

set xzeroaxis linetype 3 linewidth 2.5

Zlabel

This command sets the label for the z axis. Please see set xlabel.

Zmtics

The set zmtics command changes tics on the z axis to months of the year. Please see set xmtics for details.

Zrange

The set zrange command sets the range that will be displayed on the z axis. The zrange is used only by splot and is ignored by plot. Please see set xrange for details.

Ztics

The set ztics command controls major (labeled) tics on the z axis. Please see set xtics for details.

Cblabel

This command sets the label for the color box axis. Please see set xlabel.

Cbmtics

The set cbmtics command changes tics on the color box axis to months of the year. Please see set xmtics for details.

Cbrange

The set cbrange command sets the range of values which are colored using the current palette by styles with pm3d, with image and with palette. Values outside of the color range use color of the nearest extreme.

If the cb-axis is autoscaled in splot, then the colorbox range is taken from zrange. Points drawn in splot ... pm3d|palette can be filtered by using different zrange and cbrange.

Please see set xrange for details on set cbrange syntax. See also set palette and set colorbox.

Cbtics

The set cbtics command controls major (labeled) tics on the color box axis. Please see set xtics for details.