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.

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>}} {fixed}
                {filled | empty | nofilled | noborder}
                {front | back}
                {linestyle | ls <line_style>}
                {linetype | lt <line_type>}
                {linewidth | lw <line_width>}
                {linecolor | lc <colorspec>}
                {dashtype | dt <dashtype>}
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, xy, or paxis {n}. 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.

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.

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.

Noextend

set autoscale noextend

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.

Examples

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

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.

See also polar demos.

Bind

show bind shows 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 | behind}
           {linestyle | ls <line_style>}
           {linetype | lt <line_type>} {linewidth | lw <line_width>}
           {linecolor | lc <colorspec>} {dashtype | dt <dashtype>}
           {polar}
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:

Graph Border Encoding
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
4096 polar no effect

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.

In hidden3d plots the lines making up the border are normally subject to the same hidden3d processing as the plot elements. set border behind will override this default.

Using the optional <linestyle>, <linetype>, <linewidth>, <linecolor>, and <dashtype> specifiers, the way the border lines are drawn can be influenced (limited by what the current terminal driver supports). Besides the border itself, this line style is used for the tics, independent of whether they are plotted on the border or on the axes (see set xtics).

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.

The polar keyword enables a circular border for polar plots.

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

Boxdepth

The set boxdepth command affects only 3D plots created by splot with boxes. It sets the extent of each box along the y axis, i.e. its thickness.

Color

Gnuplot supports two alternative sets of linetypes. The default set uses a different color for each linetype, although it also allows you to draw dotted or dashed lines in that color. The alternative monochrome set uses only dot/dash pattern or linewidth to distinguish linetypes. The set color command selects the color linetypes. See set monochrome, set linetype, and set colorsequence.

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 prior to version 5.

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 deprecated. Use set cntrlabel instead. unset clabel is replaced by set cntrlabel onecolor. set clabel "format" is replaced by set cntrlabel format "format".

Clip

Syntax:
set clip {points|one|two|radial}
unset clip {points|one|two|radial}
show clip

Default state:

unset clip points
set clip one
unset clip two
unset clip radial

Data points whose center lies inside the plot boundaries are normally drawn even if the finite size of the point symbol causes it to extend past a boundary line. set clip points causes such points to be clipped (i.e. not drawn) even though the point center is inside the boundaries of a 2D plot. Data points whose center lies outside the plot boundaries are never drawn.

unset clip causes a line segment in a plot not to be drawn if either end of that segment lies outside the plot boundaries (i.e. xrange and yrange).

set clip one causes gnuplot to draw the in-range portion of line segments with one endpoint in range and one endpoint out of range. set clip two causes gnuplot to draw the in-range portion of line segments with both endpoints out of range. Line segments that lie entirely outside the plot boundaries are never drawn.

set clip radial affects plotting only in polar mode. It clips lines against the radial bound established by set rrange [0:MAX]. This criteria is applied in conjunction with set clip {one|two}. I.e. the portion of a line between two points with R > RMAX that passes through the circle R = RMAX is drawn only if both clip two and clip radial are set.

Notes:

* set clip affects only points and lines produced by plot styles lines, linespoints, points, arrows, and vectors.

* Clipping of colored quadrangles drawn for pm3d surfaces and other solid objects is controlled set pm3d clipping. The default is smooth clipping against the current zrange.

* Object clipping is controlled by the clip or noclip property of the individual object.

* In the current version of gnuplot, "plot with vectors" in polar mode does not test or clip against the maximum radius.

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 or pointnumber 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 { <n> 
                           | auto {<n>}
                           | discrete <z1> {,<z2>{,<z3>...}}
                           | incremental <start>, <incr> {,<end>}
                         }
                  {{un}sorted}
                  {firstlinetype N}
                }
              }
show contour

This command has two functions. First, it sets the values of z for which contours are to be determined. The number of contour levels <n> should be an integral constant expression. <z1>, <z2> ... are real-valued expressions. Second, it controls the appearance of the individual contour lines.

Keywords controlling the smoothness of contour lines:

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.

Keywords controlling the selection of contour levels:

levels auto — This is the default. <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).

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.

levels 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 multiplicative factor, as it is for set ztics, and <end> should not be used.

Keywords controlling the assignment of linetype to contours:

By default the contours are generated in the reverse order specified (unsorted). Thus set cntrparam levels increment 0, 10, 100 will create 11 contours levels starting with 100 and ending with 0. Adding the keyword sorted re-orders the contours by increasing numerical value, which in this case would mean the first contour is drawn at 0.

By default contours are drawn using successive linetypes starting with the next linetype after that used for the corresponding surface. Thus splot x*y lt 5 would use lt 6 for the first contour generated. If hidden3d mode is active then each surface uses two linetypes. In this case using default settings would cause the first contour to use the same linetype as the hidden surface, which is undesirable. This can be avoided in either of two ways. (1) Use set hidden3d offset N to change the linetype used for the hidden surface. A good choice would be offset -1 since that will avoid all the contour linetypes. (2) Use the set cntrparam firstlinetype N option to specify a block of linetypes used for contour lines independent of whatever was used for the surface. This is particularly useful if you want to customize the set of contour linetypes. N <= 0 restores the default.

If the command set cntrparam is given without any arguments specified all options are reset to the default:

set cntrparam order 4 points 5
set cntrparam levels auto 5 unsorted
set cntrparam firstlinetype 0

Examples

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

To define and use a customized block of contour linetypes

set linetype 100 lc "red" dt '....'
do for [L=101:199] {
    if (L%10 == 0) {
        set linetype L lc "black" dt solid lw 2
    } else {
        set linetype L lc "gray" dt solid lw 1
    }
}
set cntrparam firstlinetype 100
set cntrparam sorted levels incremental 0, 1, 100

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 } {{no}invert}
           { 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 "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.

While set contour is in effect, splot with <style> will place the style elements (points, lines, impulses, labels, etc) along the contour lines. with pm3d will produce a pm3d surface and also contour lines. If you want to mix other plot elements, say labels read from a file, with the contours generated while set contour is active you must append the keyword nocontours after that clause in the splot command.

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. Several options are currently implemented.

Set datafile columnheaders

The set datafile columnheaders command guarantees that the first row of input will be interpreted as column headers rather than as data values. It affects all input data sources to plot, splot, fit, and stats commands. If this setting is disabled by unset datafile columnheaders, the same effect is triggered on a per-file basis if there is an explicit columnheader() function in a using specifier or plot title associated with that file. See also set key autotitle and columnheader.

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

Syntax:
set datafile missing "<string>"
set datafile missing NaN
show datafile missing
unset datafile

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. Gnuplot makes a distinction between missing data and invalid data (e.g. "NaN", 1/0.). For example invalid data causes a gap in a line drawn through sequential data points; missing data does not.

Non-numeric characters found in a numeric field will usually be interpreted as invalid rather than as a missing data point unless they happen to match the missing string.

Conversely set datafile missing NaN causes all data or expressions evaluating to not-a-number (NaN) to be treated as missing data.

The example below shows differences between gnuplot version 4 and version 5. 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 in gnuplot 4 and gnuplot 5 because the third line contains only one valid number. Version 4 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.

Similarly gnuplot 5.4 will notice the missing value flag in column N whether the plot command specifies using N or using ($N) or using (func($N)). However if the "missing" value is encountered during evaluation of some more complicated expression, e.g. using (column(strcol(1)), it may evaluate to NaN and be treated as invalid data rather than as a missing data point. If you nevertheless want to treat this as missing data, use the command set datafile missing NaN.

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 command set datafile commentschars specifies what characters can be used in a data file to begin comment lines. If the first non-blank character on a line is one of these characters then the rest of the data 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
will be interpreted as garbage in the 2nd column followed by valid data in the 3rd and 4th columns.

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, including 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 by the inverse of its distance from the grid point raised to some power. The power is specified as an optional integer parameter that defaults to 1. 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(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 prior to UTF-8.
              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 pdf 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, as it may affect the choice of appropriate fonts.

Errorbars

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

Syntax:

set errorbars {small | large | fullwidth | <size>} {front | back}
              {line-properties}
unset errorbars
show errorbars

small is a synonym for 0.0 (no crossbar), 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).

Error bars are by default drawn using the same line properties as the border of the associated box. You can change this by providing a separate set of line properties for the error bars.

set errorbars linecolor black linewidth 0.5 dashtype '.'

Fit

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

Syntax:

set fit {nolog | logfile {"<filename>"|default}}
        {{no}quiet|results|brief|verbose}
        {{no}errorvariables}
        {{no}covariancevariables}
        {{no}errorscaling}
        {{no}prescale}
        {maxiter <value>|default}
        {limit <epsilon>|default}
        {limit_abs <epsilon_abs>}
        {start-lambda <value>|default}
        {lambda-factor <value>|default}
        {script {"<command>"|default}}
        {v4 | v5}
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 in version 4.

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 1 sprintf("a=%6.2f +/- %6.2f", a, 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".

In version 5 the syntax of the fit command changed and it now defaults to unitweights if no 'error' keyword is given. The v4 option restores the default behavior of gnuplot version 4, see also fit.

Fontpath

Syntax:
set fontpath "/directory/where/my/fonts/live"
set term postscript fontfile <filename>

[DEPRECATED in version 5.4]

The fontpath directory is relevant only for embedding fonts in postscript output produced by the postscript terminal. It has no effect on other gnuplot terminals. If you are not embedding fonts you do not need this command, and even if you are embedding fonts you only need it for fonts that cannot be found via the other paths below.

Earlier versions of gnuplot tried to emulate a font manager by tracking multiple directory trees containing fonts. This is now replaced by a search in the following places: (1) an absolute path given in the set term postscript fontfile command (2) the current directory (3) any of the directories specified by set loadpath (4) the directory specified by set fontpath (5) the directory provided in environmental variable GNUPLOT_FONTPATH

Note: The search path for fonts specified by filename for the libgd terminals (png gif jpeg sixel) is controlled by 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>"} {numeric|timedate|geographic}
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:
Tic-mark label numerical format specifiers
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 like %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 pi

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

There are two groups of time format specifiers: time/date and relative time. These may be used to generate axis tic labels or to encode time in a string. See set xtics time, strftime, strptime.

The time/date formats are

Date Specifiers
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, 001–366
%m month, 01–12
%M minute, 00–60
%p "am" or "pm"
%r shorthand for "%I:%M:%S %p" (only output)
%R shorthand for %H:%M" (only output)
%S second, integer 00–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 (CDC/MMWR "epi week") (ignored on input)
%w day of the week, 0–6 (Sunday = 0)
%W week of the year (ISO 8601 week date) (ignored on input)
%y year, 0-99 in range 1969-2068
%Y year, 4-digit
%z timezone, [+-]hh:mm
%Z timezone name, ignored string

For more information on the %W format (ISO week of year) see tm_week. The %U format (CDC/MMWR epidemiological week) is similar to %W except that it uses weeks that start on Sunday rather than Monday. Caveat: Both the %W and the %U formats were unreliable in gnuplot versions prior to 5.4.2. See unit test "week_date.dem".

The relative time formats express the length of a time interval on either side of a zero time point. The relative time formats are

Time Specifiers
Format Explanation
%tD +/- days relative to time=0
%tH +/- hours relative to time=0 (does not wrap at 24)
%tM +/- minutes relative to time=0
%tS +/- seconds associated with previous tH or tM field

Numerical formats may be preceded by a "0" ("zero") to pad the field with leading zeroes, and preceded by a positive digit to define the minimum field width. The %S, and %t formats also accept a precision specifier so that fractional hours/minutes/seconds can be written.

Examples

Examples of date format:

Suppose the x value in seconds corresponds a time slightly before midnight on 25 Dec 1976. The text printed for a tic label at this position would be

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"

Examples of time format:

The date format specifiers encode a time in seconds as a clock time on a particular day. So hours run only from 0-23, minutes from 0-59, and negative values correspond to dates prior to the epoch (1-Jan-1970). In order to report a time value in seconds as some number of hours/minutes/seconds relative to a time 0, use time formats %tH %tM %tS. To report a value of -3672.50 seconds

set format x                 # default date format "12/31/69 \n 22:58"
set format x "%tH:%tM:%tS"   # "-01:01:12"
set format x "%.2tH hours"   # "-1.02 hours"
set format x "%tM:%.2tS"     # "-61:12.50"

Tm_week

The tm_week(t, standard) function interprets its first argument t as a time in seconds from 1 Jan 1970. Despite the name of this function it does not report a field from the POSIX tm structure.

If standard = 0 it returns the week number in the ISO 8601 "week date" system. This corresponds to gnuplot's %W time format. If standard = 1 it returns the CDC epidemiological week number ("epi week"). This corresponds to gnuplot's %U time format. For corresponding inverse functions that convert week dates to calendar time see weekdate_iso, weekdate_cdc.

In brief, ISO Week 1 of year YYYY begins on the Monday closest to 1 Jan YYYY. This may place it in the previous calendar year. For example Tue 30 Dec 2008 has ISO week date 2009-W01-2 (2nd day of week 1 of 2009). Up to three days at the start of January may come before the Monday of ISO week 1; these days are assigned to the final week of the previous calendar year. E.g. Fri 1 Jan 2021 has ISO week date 2020-W53-05.

The US Center for Disease Control (CDC) epidemiological week is a similar week date convention that differs from the ISO standard by defining a week as starting on Sunday, rather than on Monday.

Weekdate_iso

Syntax:
time = weekdate_iso( year, week [, day] )

This function converts from the year, week, day components of a date in ISO 8601 "week date" format to the calendar date as a time in seconds since the epoch date 1 Jan 1970. Note that the nominal year in the week date system is not necessarily the same as the calendar year. The week is an integer from 1 to 53. The day parameter is optional. If it is omitted or equal to 0 the time returned is the start of the week. Otherwise day is an integer from 1 (Monday) to 2 (Sunday). See tm_week for additional information on an inverse function that converts from calendar date to week number in the ISO standard convention.

Example:

# Plot data from a file with column 1 containing ISO weeks
#     Week     cases  deaths
#     2020-05    432       1
calendar_date(w) = weekdate_iso( int(w[1:4]), int(w[6:7]) )
set xtics time format "%b\n%Y"
plot FILE using (calendar_date(strcol(1))) : 2   title columnhead

Weekdate_cdc

Syntax:
time = weekdate_cdc( year, week [, day] )

This function converts from the year, week, day components of a date in the CDC/MMWR "epi week" format to the calendar date as a time in seconds since the epoch date 1 Jan 1970. The CDC week date convention differs from the ISO week date in that it is defined in terms of each week running from day 1 = Sunday to day 6 = Saturday. If the third parameter is 0 or is omitted, the time returned is the start of the week. See tm_week and weekdate_iso.

Function style

This form of the command is deprecated. Please use 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}rtics}
         {{no}{m}cbtics}
         {polar {<angle>}}
         {layerdefault | front | back}
         {{no}vertical}
         {<line-properties-major> {, <line-properties-minor>}}
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 (see set style line).

A polar grid can be drawn for 2D plots. This is the default action of set grid if the program is already in polar mode, but can be enabled explicitly by set grid polar <angle> rtics whether or not the program is in polar mode. Circles are drawn to intersect major and/or minor tics along the r axis, and radial lines are drawn with a spacing of <angle>. Tic marks around the perimeter are controlled by set ttics, but these do not produce radial grid lines.

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).

In 3D plots grid lines at x- and y- axis tic positions are by default drawn only on the base plane parallel to z=0. The vertical keyword activates drawing grid lines in the xz and yz planes also, running from zmin to zmax.

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.

hidden3d also affects 3D plotting styles points, labels, vectors, and impulses even if no surface is present in the graph. Unobscured portions of each vector are drawn as line segments (no arrowheads). 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
original quadrangle:  A--B      displayed quadrangle:     |\   |
  ("set view 0,0")    | /|    ("set view 75,75" perhaps)  | \  |
                      |/ |                                |  \ |
                      C--D                                |   \|
                                                          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.

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.

Isosurface

Syntax:
set isosurface {mixed|triangles}
set isosurface {no}insidecolor <n>
Surfaces plotted by the command splot $voxelgrid with isosurface are by default constructed from a mixture of quadrangles and triangles. The use of quadrangles creates a less complicated visual impression. This is the default. This command proveds an option to tessellate with only triangles.

By default the inside of an isosurface is drawn in a separate color. The method of choosing that color is the same as for hidden3d surfaces, where an offset <n> is added to the base linetype. To draw both the inside and outside surfaces in the same color, use set isosurface noinsidecolor.

Jitter

Syntax:
set jitter {overlap <yposition>} {spread <factor>} {wrap <limit>}
           {swarm|square|vertical}
Examples:
set jitter                    # jitter points within 1 character width
set jitter overlap 1.5        # jitter points within 1.5 character width
set jitter over 1.5 spread 0.5  # same but half the displacement on x

When one or both coordinates of a data set are restricted to discrete values then many points may lie exactly on top of each other. Jittering introduces an offset to the coordinates of these superimposed points that spreads them into a cluster. The threshold value for treating the points as being overlapped may be specified in character widths or any of the usual coordinate options. See coordinates. Jitter affects 2D plot styles with points and with impulses. It also affects 3D plotting of voxel grids.

The default jittering operation displaces points only along x. This produces a distinctive pattern sometimes called a "bee swarm plot". The optional keyword square adjusts the y coordinate of displaced points in addition to their x coordinate so that the points lie in distinct layers separated by at least the overlap distance.

To jitter along y (only) rather than along x, use keyword vertical.

The maximum displacement (in character units) can be limited using the wrap keyword.

Note that both the overlap criterion and the magnitude of jitter default to one character unit. Thus the plot appearance will change with the terminal font size, canvas size, or zoom factor. To avoid this you can specify the overlap criterion in the y axis coordinate system (the first keyword) and adjust the point size and spread multiplier as appropriate. See coordinates, pointsize.

Caveat: jitter is incompatible with "pointsize variable".

set jitter is also useful in 3D plots of voxel data. Because voxel grids are regular lattices of evenly spaced points, many view angles cause points to overlap and/or generate Moiré patterns. These artifacts can be removed by displacing the symbol drawn at each grid point by a random amount.

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 | fixed} | {lmargin | rmargin | tmargin | bmargin}
        | {at <position>}}
      {left | right | center} {top | bottom | center}
      {vertical | horizontal} {Left | Right}
      {{no}enhanced}
      {{no}opaque {fc <colorspec>}}
      {{no}reverse} {{no}invert}
      {samplen <sample_length>} {spacing <line_spacing>}
      {width <width_increment>} {height <height_increment>}
      {{no}autotitle {columnheader}}
      {title {"<text>"} {{no}enhanced} {center | left | right}}
      {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.

The text in the key is set in enhanced mode by default, this can be changed with the {no}enhanced option, also independently for the key title only and for each individual plot.

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 or the requested fill color and then the key symbols and titles are written. 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.

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 justification of the title defaults to center and can be changed by the keywords right or left

The defaults for set key are on, right, top, vertical, Right, noreverse, noinvert, samplen 4, spacing 1, notitle, 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.

Each plot is represented in the key by a single line containing a line or symbol or shape representing the plot style and a corresponding title. Using the keyword notitle in the plot command will suppress generation of the line. Contour plots generated additional entries in the key, one for each contour (see cntrlabel). You can add extra lines to the key by inserting a dummy plot command that uses the keyword keyentry rather than a filename or a function. See keyentry.

When using the TeX/LaTeX group of terminals or terminals in which formatting information is embedded in the string, gnuplot can only estimate the 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.

3D key

Placement of the key for 3D plots (splot) by default uses the fixed option. Note: this is a change from gnuplot version 5.0 and earlier. fixed placement is very similar to inside placement with one important difference. The plot boundaries of a 3D plot change as the view point is rotated or scaled. If the key is positioned inside these boundaries then the key also moves when the view is changed. fixed positioning ignores changes to the view angles or scaling; i.e. the key remains fixed in one location on the canvas as the plot is rotated.

For 2D plots the fixed option is exactly equivalent to inside.

If splot is being used to draw contours, by default a separate key entry is generated for each contour level with a distinct line type. To modify this see set cntrlabel.

Key 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

Extra key entries

Normally each plot autogenerates a single line entry in the key. If you need more control over what appears in the key you can use the keyentry keyword in the plot or splot command to insert extra lines. Instead of providing a filename or function to plot, use keyentry as a placeholder followed by plot style information (used to generate a key symbol) and a title. All the usual options for title font, text color, at coordinates, and enhanced text markup apply. Example:
plot $HEATMAP matrix with image notitle, \
     keyentry with boxes fc palette cb 0 title "no effect", \
     keyentry with boxes fc palette cb 1 title "threshold", \
     keyentry with boxes fc palette cb 3 title "typical range", \
     keyentry with labels nopoint title "as reported in [12]", \
     keyentry with boxes fc palette cb 5 title "strong effect"

Key autotitle

set key autotitle causes each plot to be identified in the key by the name of the data file or function used in the plot command. This is the default. set key noautotitle disables the automatic generation of plot titles. 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

Note: The effect of set key autotitle columnheader, treatment of the first line in a data file as column headers rather than data applies even if the key is disabled by unset key. It also applies to stats and fit commands even though they generate no key. If you want the first line of data to be treated as column headers but not to use them for plot titles, use set datafile columnheaders.

In all cases an explicit title or notitle keyword in the plot command itself will override the default from set key autotitle.

Key placement

This section describes placement of the primary, auto-generated key. To construct a secondary key or place plot titles elsewhere, see multiple keys.

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.

Key entry lines are single-spaced based on the current font size. This can be adjusted by set key spacing <line-spacing>.

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.

Multiple keys

It is possible to construct a legend/key manually rather than having the plot titles all appear in the auto-generated key. This allows, for example, creating a single legend for the component panels in a multiplot. Here is an example:
set multiplot layout 3,2 columnsfirst
set style data boxes
plot $D using 0:6  lt 1 title at 0.75, 0.20
plot $D using 0:12 lt 2 title at 0.75, 0.17
plot $D using 0:13 lt 3 title at 0.75, 0.14
plot $D using 0:14 lt 4 title at 0.75, 0.11
set label 1 at screen 0.75, screen 0.22 "Custom combined key area"
plot $D using 0:($6+$12+$13+$14) with linespoints title "total"
unset multiplot

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>}
          {nobox} {boxed {bs <boxstyle>}}
          {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, polar, graph, screen, or character to indicate 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. Not all terminals can handle boxes for rotated text.

If rotate is given, the label is written vertically. If rotate by <degrees> is given, the baseline of the text will be set to the specified angle. Some terminals do not support text rotation.

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. In this case the properties textcolor, rotate, and pointsize may be followed by keyword variable rather than by a fixed value. In this case the corresponding property of individual labels is determined by additional columns in the using specifier.

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'

For the wxt and qt terminals, left-click on a hypertext anchor after the text has appeared will copy the hypertext to the clipboard.

EXPERIMENTAL (implementation details may change) Text of the form "image{<xsize>,<ysize>}:<filename>{ \n<caption text>}" will trigger display of the image file in a pop-up box. The optional size overrides a default box size 300x200. The types of image file recognized may vary by terminal type, but *.png should always work. Any additional text lines following the image filename are displayed as usual for hypertext. Example:

set label 7 "image:../figures/Fig7_inset.png\nFigure 7 caption..."
set label 7 at 10,100 hypertext point pt 7

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, whatever linetypes one and two look like to begin with, 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. This includes uses such as the definition of a temporary linestyle derived from the base linetype 1. Similarly lt 2 will now produce a thick green line.

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

set linetype 1 lc rgb "dark-violet" lw 2 pt 1
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).

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 x2

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 x2range, set auto x, etc will affect both the x and x2 axes.

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

In this version of gnuplot macro substitution is always enabled. Tokens in the command line of the form @<stringvariablename> will be replaced by the text string contained in <stringvariablename>. See substitution.

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. 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 lmargin {{at screen} <margin>}
set rmargin {{at screen} <margin>}
set tmargin {{at screen} <margin>}
set bmargin {{at screen} <margin>}
set margins <left>, <right>, <bottom>, <top>
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.

Micro

By default the "%c" format specifier for scientific notation used to generate axis tick labels uses a lower case u as a prefix to indicate "micro" (10^-6). The set micro command tells gnuplot to use a different typographic character (unicode U+00B5). The byte sequence used to represent this character depends on the current encoding. See format specifiers, encoding.

This command is EXPERIMENTAL. Implementation details may change.

Minussign

Gnuplot uses the C language library routine sprintf() for most formatted input. However it also has its own formatting routine gprintf() that is used to generate axis tic labels. The C library routine always use a hyphen character (ascii \055) to indicate a negative number, as in -7. Many people prefer a different typographic minus sign character (unicode U+2212) for this purpose, as in −7. The command
set minussign

causes gprintf() to use this minus sign character rather than a hyphen in numeric output. In a utf-8 locale this is the multibyte sequence corresponding to unicode U+2212. In a Window codepage 1252 locale this is the 8-bit character ALT+150 ("en dash"). The set minussign command will affect axis tic labels and any labels that are created by explicitly invoking gprintf. It has no effect on other strings that contain a hyphen. See gprintf.

Note that this command is ignored when you are using any of the LaTeX terminals, as LaTeX has its own mechanism for handling minus signs. It also is not necessary when using the postscript terminal because the postscript prologue output by gnuplot remaps the ascii hyphen code \055 to a different glyph named minus.

This command is EXPERIMENTAL. Implementation details may change.

Example (assumes utf8 locale):

set minus
A = -5
print "A = ",A                 # printed string will contain a hyphen
print gprintf("A = %g",A)      # printed string will contain character U+2212
set label "V = -5"             # label will contain a hyphen
set label sprintf("V = %g",-5) # label will contain a hyphen
set label gprintf("V = %g",-5) # label will contain character U+2212

Monochrome

Syntax:
set monochrome {linetype N <linetype properties>}

The set monochrome command selects an alternative set of linetypes that differ by dot/dash pattern or line width rather than by color. This command replaces the monochrome option offered by certain terminal types in earlier versions of gnuplot. For backward compatibility these terminal types now implicitly invoke "set monochrome" if their own "mono" option is present. For example,

set terminal pdf mono
is equivalent to
set terminal pdf
set mono

Selecting monochrome mode does not prevent you from explicitly drawing lines using RGB or palette colors, but see also set palette gray. Six monochrome linetypes are defined by default. You can change their properties or add additional monochrome linetypes by using the full form of the command. Changes made to the monochrome linetypes do not affect the color linetypes and vice versa. To restore the usual set of color linetypes, use either unset monochrome or set color.

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. Mouse button 3 controls the azimuth of the z axis (see set view azimuth).

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}
          {zoomfactors <xmultiplier>, <ymultiplier>}
          {noruler | ruler {at x,y}}
          {polardistance{deg|tan} | nopolardistance}
          {format <string>}
          {mouseformat <int> | <string> | function <f(x,y)>}
          {{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 on some terminals. The default value is 300 ms. Setting the value to 0 ms triggers the copy on a single click.

Format

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".

This setting is superseded by "set mouse mouseformat".

Mouseformat

Syntax:
set mouse mouseformat i
set mouse mouseformat "custom format"
set mouse mouseformat function string_valued_function(x, y)
This command controls the format used to report the current 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 7 and should contain two float specifiers, one for x and one for y.

Use of a custom function returning a string is EXPERIMENTAL. It allows readout of coordinate systems in which inverse mapping from screen coordinates to plot coordinates requires joint consideration of both x and y. See for example the map_projection demo.

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:

0   default (same as 1)
1   axis coordinates                    1.23, 2.45
2   graph coordinates (from 0 to 1)    /0.00, 1.00/
3   x = timefmt     y = axis           [(as set by `set timefmt`), 2.45]
4   x = date        y = axis           [31. 12. 1999, 2.45]
5   x = time        y = axis           [23:59, 2.45]
6   x = date time   y = axis           [31. 12. 1999 23:59, 2.45]
7   format from `set mouse mouseformat <format-string>`
8   format from `set mouse mouseformat function <func>`

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.

Mttics

Minor tic marks around the perimeter of a polar plot are controlled by by set mttics. Please see set mxtics.

Multiplot

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

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 to inset a small plot inside a larger plot.

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 uniform margins for all plots in the layout with options layout margins and spacing, which must be used together. With margins you set the outer margins of the whole multiplot grid.

spacing gives the gap size between two adjacent subplots, and can also be given in character or screen units. If a single value is given, it is used for both x and y direction, otherwise two different values can be selected.

If one value has no unit, the one of the preceding margin setting is used.

Example:

set multiplot layout 2,2 margins 0.1, 0.9, 0.1, 0.9 spacing 0.0

In this case the two left-most subplots will have left boundaries at screen coordinate 0.1, the two right-most subplots will have right boundaries at screen coordinate 0.9, and so on. Because the spacing between subplots is given as 0, their inner boundaries will superimpose.

Example:

set multiplot layout 2,2 margins char 5,1,1,2 spacing screen 0, char 2

This produces a layout in which the boundary of both left subplots is 5 character widths from the left edge of the canvas, the right boundary of the right subplots is 1 character width from the canvas edge. The overall bottom margin is one character height and the overall top margin is 2 character heights. There is no horizontal gap between the two columns of subplots. The vertical gap between subplots is equal to 2 character heights.

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, mttics 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.

Nonlinear

Syntax:
set nonlinear <axis> via f(axis) inverse g(axis)
unset nonlinear <axis>

This command is similar to the set link command except that only one of the two linked axes is visible. The hidden axis remains linear. Coordinates along the visible axis are mapped by applying g(x) to hidden axis coordinates. f(x) maps the visible axis coordinates back onto the hidden linear axis. You must provide both the forward and inverse expressions.

To illustrate how this works, consider the case of a log-scale x2 axis.

set x2ange [1:1000]
set nonlinear x2 via log10(x) inverse 10**x

This achieves the same effect as set log x2. The hidden axis in this case has range [0:3], obtained by calculating [log10(xmin):log10(xmax)].

The transformation functions f() and g() must be defined using a dummy variable appropriate to the nonlinear axis:

axis: x x2   dummy variable x
axis: y y2   dummy variable y
axis: z cb   dummy variable z
axis: r      dummy variable r

Example:

set xrange [-3:3]
set nonlinear x via norm(x) inverse invnorm(x)

This example establishes a probability-scaled ("probit") x axis, such that plotting the cumulative normal function Phi(x) produces a straight line plot against a linear y axis.

Example:

logit(p) = log(p/(1-p))
logistic(a) = 1. / (1. + exp(-a))
set xrange [.001 : .999]
set nonlinear y via logit(y) inverse logistic(y)
plot logit(x)

This example establishes a logit-scaled y axis such that plotting logit(x) on a linear x axis produces a straight line plot.

Example:

f(x) = (x <= 100) ? x : (x < 500) ? NaN : x-390
g(x) = (x <= 100) ? x : x+390
set xrange [0:1000] noextend
set nonlinear x via f(x) inverse g(x)
set xtics add (100,500)
plot sample [x=1:100] x, [x=500:1000] x

This example creates a "broken axis". X coordinates 0-100 are at the left, X coordinates 500-1000 are at the right, there is a small gap (10 units) between them. So long as no data points with (100 < x < 500) are plotted, this works as expected.

Object

The set object command defines a single object which will appear in subsequent 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. Objects to be drawn in 2D plots may be defined in any combination of axis, graph, polar, or screen coordinates.

Object specifications in 3D plots cannot use graph coordinates. Rectangles and ellipses in 3D plots are limited to screen coordinates.

Syntax:

set object <index>
    <object-type> <object-properties>
    {front|back|behind|depthorder}
    {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.

The options front, back, behind control whether the object is drawn before or after the plot itself. See layers. 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>]} {no{wedge}}
    {<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. In 2D plots the position and radius may be given in any coordinate system. See coordinates. Circles in 3D plots cannot use graph 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 style circle, 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 any coordinate system. 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

Depthorder

The option set object N depthorder applies to 3D polygon objects only. Rather than assigning the object to layer front/back/behind it is included in the list of pm3d quadrangles sorted and rendered in order of depth by set pm3d depthorder. As with pm3d surfaces, two-sided coloring can be generated by specifying the object fillcolor as a linestyle. In this case the ordering of the first three vertices in the polygon determines the "side".

If you set this property for an object that is not a 3D polygon it probably will not be drawn at all.

Offsets

Autoscaling sets the x and y axis ranges to match the coordinates of the data that is plotted. Offsets provide a mechanism to expand these ranges to leave empty space between the data and the plot borders. Autoscaling then further extends each range to reach the next axis tic unless this has been suppressed by set autoscale noextend or set xrange noextend. See noextend. Offsets affect only scaling for the x1 and y1 axes.

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 graph dimension by using the keyword "graph". Only "graph" offsets are possible for nonlinear axes.

A positive offset expands the axis range in the specified direction, e.g. a positive bottom offset makes ymin more negative. Negative offsets interact badly with autoscaling and clipping.

Example:

set autoscale noextend
set offsets graph 0.05, 0, 2, 2
plot sin(x)

This graph of sin(x) will have y range [-3:3] because the function will be autoscaled to [-1:1] and the vertical offsets add 2 at each end of the range. 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.

Overflow

Syntax:
set overflow {float | NaN | undefined}
unset overflow

This version of gnuplot supports 64-bit integer arithmetic. This means that for values from 2^53 to 2^63 (roughly 10^16 to 10^19) integer evaluation preserves more precision than evaluation using IEEE 754 floating point arithmetic. However unlike the IEEE floating point representation, which sacrifices precision to span a total range of roughly [-10^307 : 10^307], integer operations that result in values outside the range [-2^63 : 2^63] overflow. The set overflow command lets you control what happens in case of overflow. See options below.

set overflow is the same as set overflow float. It causes the result to be returned as a real number rather than as an integer. This is the default.

The command unset overflow causes integer arithmetic overflow to be ignored. No error is shown. This may be desirable if your platform allows only 32-bit integer arithmetic and you want to approximate the behaviour of gnuplot versions prior to 5.4.

The reset command does not affect the state of overflow handling.

Earlier gnuplot versions were limited to 32-bit arithmetic and ignored integer overflow. Note, however, that some built-in operators did not use integer arithmetic at all, even when given integer arguments. This included the exponentiation operator N**M and the summation operator (see summation). These operations now return an integer value when given integer arguments, making them potentially susceptible to overflow and thus affected by the state of set overflow.

Float

If an integer arithmetic expression overflows the limiting range, [-2^63 : 2^63] for 64-bit integers, the result is returned as a floating point value instead. This is not treated as an error. Example:
gnuplot> set overflow float
gnuplot> A = 2**62 - 1;  print A, A+A, A+A+A
4611686018427387903 9223372036854775806 1.38350580552822e+19

NaN

If an integer arithmetic expression overflows the limiting range, [-2^63 : 2^63] for 64-bit integers, the result is returned as NaN (Not a Number). This is not treated as an error. Example:
gnuplot> set overflow NaN
gnuplot> print 10**18, 10**19
1000000000000000000 NaN

Undefined

If an integer arithmetic expression overflows the limiting range, [-2^63 : 2^63] for 64-bit integers, the result is undefined. This is treated as an error. Example:
gnuplot> set overflow undefined
gnuplot> A = 10**19
             ^
         undefined value

Affected operations

The set overflow state affects the arithmetic operators
+ - * / **
and the built-in summation operation sum.

All of these operations will return an integer result if all of the arguments are integers, so long as no overflow occurs during evaluation.

The set overflow state does not affect logical or bit operations

<< >>  | ^ &

If overflow occurs at any point during the course of evaluating of a summation set overflow float will cause the result to be returned as a real number even if the final sum is within the range of integer representation.

Palette

The palette is a set of colors, usually ordered in the form of one or more stepped gradients, used for pm3d surfaces and other graph elements colored by z value. Colors in the current palette are automatically mapped from plot coordinates z values or an extra data column of gray values. Palette colors also can be accessed explicitly in a color specification (see colorspec)
  • as a gray value also known as palette fraction in the range [0:1]
  • as a z value corresponding to the z coordinate of a plot element
  • as a cb value in the range [cbmin:cbmax] (see set cbrange)
The current palette is shown by default in a separate colorbox drawn next to plots that use plot style pm3d. The colorbox can be manually selected or disabled. See set 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 } }
           { 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 model to one of RGB, HSV, CMY. 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, or C, 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, Blue; CMY stands for Cyan, Magenta, Yellow; HSV stands for Hue, Saturation, Value. For more information on color models see: http://en.wikipedia.org/wiki/Color_space

Note: Earlier gnuplot versions accepted YIQ and XYZ color space models also, but the implementation was never complete or correct.

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 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 RGB functions 1.1*gray**0.25, gray**0.75, 0

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)

Gray

set palette gray switches to a grayscale palette shading from 0.0 = black to 1.0 = white. set palette color is an easy way to switch back from the gray palette to the last color mapping.

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

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>}
set paxis <axisno> label <label-options> { offset <radial-offset> }
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 and spiderplots. See parallelaxes, set xrange, and set xtics. The normal options to the range and tics commands are accepted although not all options make sense for parallel axis plots.

set paxis <axisno> label <label-options> is relevant to spiderplots but ignored otherwise. Axes of a parallel axis plot can be labeled using the title option of the plot command, which generates an xtic label. Note that this may require also set xtics.

The axis linetype properties are controlled using set style parallelaxis.

Pixmap

Syntax:
set pixmap <index> "filename" at <position>
           {width <w> | height <h> | size <w>,<h>}
           {front|back|behind} {center}
show pixmaps
unset pixmaps
unset pixmap <index>

The set pixmap command is similar to set object in that it defines an object that will appear on subsequent plots. The rectangular array of red/green/blue/alpha values making up the pixmap are read from a png, jpeg, or gif file. The position and extent occupied by the pixmap in the gnuplot output may be specified in any coordinate system (see coordinates). The coordinates given by at <position> refer to the lower left corner of the pixmap unless keyword center is present.

If the x-extent of the rendered pixmap is set using width <x-extent> the aspect ratio of the original image is retained and neither the aspect ratio nor the orientation of the pixmap changes with axis scaling or rotation. Similarly if the y-extent is set using height <y-extent>. If both the x-extent and y-extent are given using size <x-extent> <y-extent> this overrides the original aspect ratio. If no size is set then the original size in pixels is used (the effective size is then terminal-dependent).

Pixmaps are not clipped to the border of the plot. As an exception to the general behaviour of objects and layers, a pixmap assigned to layer behind is rendered for only the first plot in a multiplot. This allows all panels in a multiplot to share a single background pixmap.

Examples:

# Use a gradient as the background for all plotting
# Both x and y will be resized to fill the entire canvas
set pixmap 1 "gradient.png"
set pixmap 1 at screen 0, 0 size screen 1, 1 behind
# Place a logo at the lower right of each page plotted
set pixmap 2 "logo.jpg"
set pixmap 2 at screen 0.95, 0 width screen 0.05 behind
# Place a small image at some 3D coordinate
# It will move as if attached to the surface being plotted
# but will always face forward and remain upright
set pixmap 3 "image.png" at my_x, my_y, f(my_x,my_y) width screen .05
splot f(x,y)

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 allows plotting gridded or non-gridded data without preprocessing. pm3d style options also affect solid-fill polygons used to construct other 3D plot elements.

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

set pm3d {
           { at <position> }
           { interpolate <steps/points in scan, between scans> }
           { scansautomatic | scansforward | scansbackward
                            | depthorder {base} }
           { flush { begin | center | end } }
           { ftriangles | noftriangles }
           { clip {z} | clip1in | clip4in }
           { {no}clipcb }
           { corners2color
             { mean|geomean|harmean|rms|median|min|max|c1|c2|c3|c4 }
           }
           { {no}lighting
             {primary <fraction>} {specular <fraction>} {spec2 <fraction>}
           }
           { border {<linestyle-options>}}
           { implicit | explicit }
           { map }
         }
show pm3d
unset pm3d

Note that pm3d plots are plotted sequentially in the order given in the splot command. Thus earlier plots may be obscured by later plots. To avoid this you can use the depthorder scan option.

The pm3d surfaces can be projected onto the top or bottom of the view box. 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 the demo file demo/pm3d.dem.

Implicit

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.

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.

Lighting

By default the colors assigned to pm3d objects are not dependent on orientation or viewing angle. This state corresponds to set pm3d nolighting. The command set pm3d lighting selects a simple lighting model consisting of a single fixed source of illumination contributing 50% of the overall lighting. The strength of this light relative to the ambient illumination can be adjusted by set pm3d lighting primary <fraction>. Inclusion of specular highlighting can be adjusted by setting a fractional contribution:
set pm3d lighting primary 0.50 specular 0.0   # no highlights
set pm3d lighting primary 0.50 specular 0.6   # strong highlights
Solid-color pm3d surfaces tend to look very flat without specular highlights. Since the highlights from a single source only affect one side of the surface, a second spotlight source may be desirable to add specular highlights from the opposite direction. This is controlled by "spec2 <contribution>". EXPERIMENTAL (details may change in a future version): The second spotlight is a pure red light source that by default contributes nothing (spec2 0.0). See also hidden_compare.dem (comparison of hidden3d and pm3d treatment of solid-color surfaces)

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

set pm3d {scansautomatic | scansforward | scansbackward | depthorder}

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 option

set pm3d depthorder
Note that the global option set hidden3d does not affect pm3d surfaces.

The depthorder option by itself tends to produce bad results when applied to the long thin rectangles generated by splot with boxes. It works better to add the keyword base, which performs the depth sort using the intersection of the box with the plane at z=0. This type of plot is further improved by adding a lighing model. Example:

set pm3d depthorder base
set pm3d lighting
set boxdepth 0.4
splot $DATA using 1:2:3 with boxes

Clipping

Syntax:
set pm3d {clip {z} | clip1in | clip4in}
set pm3d {no}clipcb

The component quadrangles of a pm3d surface or other 3D object are by default smoothly clipped against the current zrange. This is a change from earlier gnuplot versions.

Alternatively, surfaces can be clipped by rendering whole quadrangles but only those with all 4 corners in-range on x, y, and z (set pm3d clip4in), or only those with at least one corner in-range on x, y, and z (set pm3d clip1in). The options clip, clip1in, and clip4in are mutually exclusive.

Separate from clipping based on spatial x, y, and z coordinates, quadrangles can be rendered or not based on extreme palette color values. clipcb: (default) palette color values < cbmin are clipped to equal cbmin; palette color values > cbmax are clipped to equal cbmax. noclipcb: quadrangles with color value outside cbrange are not drawn at all.

Color_assignment

The default pm3d coloring assigns an individual color to each quadrangle of the surface grid. For alternative coloring schemes that assign uniform color to the entire surface, see pm3d fillcolor.

A single gray/color value (i.e. not a gradient) is assigned to each quadrangle. This value is calculated from the z-coordinates the four quadrangle corners according to corners2color <option>. The value is then used to select a color from the current palette. See set palette. It is not possible to change palettes inside a single splot command.

If a fourth column of data is provided, 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

Notice that ranges of z-values and color-values for surfaces are adjustable independently by set zrange, set cbrange, set log z, set log cb, etc.

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

Fillcolor

splot FOO with pm3d fillcolor <colorspec>

Plot style with pm3d accepts an optional fillcolor in the splot command. This specification is applied to the entire pm3d surface. See colorspec. Most fillcolor specifications will result in a single solid color, which is hard to interpret visually unless there is also a lighting model present to distinguish surface components based on orientation. See pm3d lighting.

There are a few special cases. with pm3d fillcolor palette would produce the same result as the default pm3d palette-based coloring, and is therefore not a useful option. with pm3d fillcolor linestyle N is more interesting. This variant assigns distinct colors to the top and bottom of the pm3d surface, similar to the color scheme used by gnuplot's hidden3d mode. Linestyle N is used for the top surface; linestyle N+1 for the bottom surface. Note that "top" and "bottom" depend on the scan order, so that the colors are inverted for pm3d scansbackward as compared to pm3d scansforward. This coloring option works best with pm3d depthorder, however, which unfortunately does not allow you to control the scan order so you may have to instead swap the colors defined for linestyles N and N+1.

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

The deprecated option set pm3d map was equivalent to set pm3d at b; set view map; set style data pm3d; set style func pm3d;

The deprecated option set pm3d hidden3d N was equivalent to set pm3d border ls N.

Pointintervalbox

The pointinterval and pointnumber properties of a line type are used only in plot style linespoints. A negative value of pointinterval or pointnumber, e.g. -N, means that before the selected set of point symbols are drawn 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) represents an angle theta. The default range of t is [0:2*pi], or [0:360] if degree units have been selected (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].

By default polar plots are oriented such that theta=0 is at the far right, with theta increasing counterclockwise. You can change both the origin and the sense explicitly. See set theta.

You may want to set size square to have gnuplot try to make the aspect ratio equal to unity, so that circles look circular. Tic marks around the perimeter can be specified using set ttics. 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]

set print with no parameters restores output 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. When printing a string to a data block, embedded newline characters are expanded to generate multiple data block entries. This is a CHANGE.

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, rlabel, set grid.

Rgbmax

Syntax:
set rgbmax {1.0 | 255}
unset rgbmax
The red/green/blue color components of an rgbimage plot are by default interpreted as integers in the range [0:255]. set rgbmax 1.0 tells the program that data values used to generate the color components of a plot with rgbimage or rgbalpha are floating point values in the range [0:1]. unset rgbmax returns to the default integer range [0:255].

Rlabel

This command places a label above the r axis. The label will be drawn whether or not the plot is in polar mode. See set xlabel for additional keywords.

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. Unlike other axes, autoscaling the raxis always results in rmin = 0. The reverse autoscaling flag is ignored. Note: Setting a negative value for rmin may produce unexpected results.

Rtics

The set rtics command places tics along the polar axis. 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 the 2D equivalent to the 3D command set view equal xy. 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

Spiderplot

The set spiderplot command switches interpretation of coordinates to a polar system in which each data point is mapped to a position along a radial axis. paxis 1 is always vertical; axes 2 to N proceed clockwise with even spacing. The command must be issued prior to plotting. It has additional effects equivalent to
set style data spiderplot
unset border
unset tics
set key noautotitle
set size ratio 1.0
Use reset to restore these after plotting.

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 or plot with 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 {<n>} {opaque|transparent} {{no}border} {fillcolor}

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 | backhead | heads}
                        {size <length>,<angle>{,<backangle>} {fixed}}
                        {filled | empty | nofilled | noborder}
                        {front | back}
                        { {linestyle | ls <line_style>}
                          | {linetype | lt <line_type>}
                            {linewidth | lw <line_width}
                            {linecolor | lc <colorspec>}
                            {dashtype | dt <dashtype>} }
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 modified using 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 with a border line around the arrow head. Specifying noborder produces filled arrow heads with no border. In this case the tip of the arrow head lies exactly on the endpoint of the vector and the arrow head is slightly smaller overall. Dashed arrows should always use noborder, since a dashed border is ugly. 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}
                  {medianlinewidth <width>}
                  {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. If outliers are not drawn they do not contribute to autoscaling.

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.

A crossbar indicating the median is drawn using the same line type as box boundary. If you want a thicker line for the median

set style boxplot medianlinewidth 2.0
If you want no median line, set this to 0.

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. 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.

Note that there is a separate default fill style for rectangles created by set obj. See set style rectangle.

Syntax:

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

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

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.

Fill color (fillcolor <colorspec>) is distinct from fill style. I.e. plot elements or objects can share a fillstyle while retaining separate colors. In most places where a fillstyle is accepted you can also specify a fill color. Fillcolor may be abbreviated fc. Otherwise the fill color is take from the current linetype. Example:

plot FOO with boxes fillstyle solid 1.0 fillcolor "cyan"

Set style fill border

The bare keyword border causes the filled object to be surrounded by a solid line of the current linetype and color. You can change the color of this line by adding either a linetype or a linecolor. noborder specifies that no bounding line is drawn. Examples:
# Half-intensity fill, full intensity border in same color
set style fill solid 0.5 border
# Half-transparent fill, solid black border (linetype -1)
set style fill transparent solid 0.5 border -1
# Pattern fill in current color, border using color of linetype 5
plot ... with boxes fillstyle pattern 2 border lt 5
# Fill area in cyan, border in blue
plot ... with boxes fillcolor "cyan" fs solid border linecolor "blue"

Note: The border property of a fill style only affects plots drawn with filledcurves in the default mode (closed curve).

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.

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>}
                       {{pointnumber | pn} <max_symbols>}
                       {{dashtype | dt} <dashtype>}
                       {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.

The pointnumber property is similar to pointinterval except that rather than plotting every Nth point it limits the total number of points to N.

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 parallelaxis

Syntax:

set style parallelaxis {front|back} {line-properties}

Determines the line type and layer for drawing the vertical axes in plots with parallelaxes. See with parallelaxes, set paxis.

Set style spiderplot

Syntax:

set style spiderplot
          {fillstyle <fillstyle-properties>}
          {<line-properties> | <point-properties>}
This commands controls the default appearance of spider plots. The fill, line, and point properties can be modified in the first component of the plot command. The overall appearance of the plot is also affected by other settings such as set grid spiderplot. See also set paxis, spiderplot. Example:
# Default spider plot will be a polygon with a thick border but no fill
set style spiderplot fillstyle empty border lw 3
# This one will additionally place an open circle (pt 6) at each axis
plot for [i=1:6] DATA pointtype 6 pointsize 3

Set style textbox

Syntax:

set style textbox {<boxstyle-index>}
          {opaque|transparent} {fillcolor <color>}
          {{no}border {<bordercolor>}}{linewidth <lw>}
          {margins <xmargin>,<ymargin>}

This command controls the appearance of labels with the attribute 'boxed'. Terminal types that do not support boxed text will ignore this style. Note: Implementation for some terminals (svg, latex) is incomplete. Most terminals cannot place a box correctly around rotated text.

Three numbered textbox styles can be defined. If no boxstyle index <bs> is given, the default (unnumbered) style is changed. Example:

# default style has only a black border
set style textbox transparent border lc "black"
# style 2 (bs 2) has a light blue background with no border
set style textbox 2 opaque fc "light-cyan" noborder
set label 1 "I'm in a box" boxed
set label 2 "I'm blue" boxed bs 2

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 a 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 blocks of data 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 values
X Y {Z} <flag>
rather than creating an actual plot on the current terminal. The flag character is "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} {append}
          {separator {whitespace|tab|comma|"<char>"}}
plot <whatever>
unset table

Subsequent tabular output is written to "outfile", if specified, otherwise it is written to stdout or other current value of set output. If outfile exists it will be replaced unless the append keyword is given. 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.

The separator character can be used to output csv (comma separated value) files. This mode only affects plot style with table. See plot with table.

Plot with table

This discussion applies only to the special plot style with table.

To avoid any style-dependent processing of the input data being tabulated (smoothing, errorbar expansion, secondary range checking, etc), or to increase the number of columns that can be tabulated, use the keyword "table" instead of a normal plot style. In this case the output does not contain an extra, last, column of flags i, o, u indicated inrange/outrange/undefined. The destination for output must first be specified with set table <where>. For example

set table $DATABLOCK1
plot <file> using 1:2:3:4:($5+$6):(func($7)):8:9:10 with table

Because there is no actual plot style in this case the columns do not correspond to specific axes. Therefore xrange, yrange, etc are ignored.

If a using term evaluates to a string, the string is tabulated. Numerical data is always written with format %g. If you want some other format use sprintf or gprintf to create a formatted string.

plot <file> using ("File 1"):1:2:3 with table
plot <file> using (sprintf("%4.2f",$1)) : (sprintf("%4.2f",$3)) with table

To create a csv file use

set table "tab.csv" separator comma
plot <foo> using 1:2:3:4 with table

[EXPERIMENTAL] To select only a subset of the data points for tabulation you can provide an input filter condition (if <expression>) at the end of the command. Note that the input filter may reference data columns that are not part of the output. This feature may change substantially before appearing in a released version of gnuplot.

plot <file> using 1:2:($4+$5) with table if (strcol(3) eq "Red")
plot <file> using 1:2:($4+$5) with table if (10. < $1 && $1 < 100.)
plot <file> using 1:2:($4+$5) with table if (filter($6,$7) != 0)

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 {linewidth <lw>}{lw <lw>}

Theta

Polar coordinate plots are by default oriented such that theta = 0 is on the right side of the plot, with theta increasing as you proceed counterclockwise so that theta = 90 degrees is at the top. set theta allows you to change the origin and direction of the polar angular coordinate theta.
set theta {right|top|left|bottom}
set theta {clockwise|cw|counterclockwise|ccw}
unset theta restores the default state "set theta right ccw".

Tics

The set tics command controls the tic marks and labels on all axes at once.

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>}"} {{no}enhanced}
         { 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

All tic marks are drawn using the same line properties as the plot border (see set border).

Set tics back or front 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 mirrored, inward-facing tic marks for the primary axes. All other settings 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 current time and date in the plot margin.

Syntax:

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

The format string is 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 along the top left or bottom left margin (default: bottom). rotate writes the timestamp vertically. 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 sets the default format used to input time data. See set xdata time, timecolumn.

Syntax:

set timefmt "<format string>"
show timefmt

The valid formats for both timefmt and timecolumn are:

Time Series timedata Format Specifiers
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
%p two character match to one of: am AM pm PM

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.

If the %p format returns "am" or "AM", hour 12 will be interpreted as hour 0. If the %p format returns "pm" or "PM", hours < 12 will be increased by 12.

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

Syntax: set trange [tmin:tmax] The range of the parametric variable t is useful in three contexts. 1) In parametric mode plot commands it limits the range of sampling
for both generating functions.  See `set parametric`, `set samples`.
2) In polar mode plot commands it limits or defines the range of the
angular parameter theta. See `polar`.
3) In plot or splot commands using 1-dimensional sampled data via
the pseudofile "+".  See `sampling 1D`, `special-filenames`.

Ttics

The set ttics command places tics around the perimeter of a polar plot. This is the border if set border polar is enabled, otherwise the outermost circle of the polar grid drawn at the rightmost ticmark along the r axis. See set grid, set rtics. The angular position is always labeled in degrees. The full perimeter can be labeled regardless of the current trange setting. The desired range of the tic labels should be given as shown below. Additional properties of the tic marks can be set. See xtics.
set ttics -180, 30, 180
set ttics add ("Theta = 0" 0)
set ttics font ":Italic" rotate

Urange

Syntax: set urange [umin:umax] The range of the parametric variables u and v is useful in two contexts. 1) splot in parametric mode. See set parametric, set isosamples. 2) generating 2-dimension sampled data for either plot or splot using the pseudofile "++". See sampling 2D.

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.

Vgrid

Syntax:
set vgrid $gridname {size N}
unset vgrid $gridname
show vgrid

If the named grid already exists, mark it as active (use it for subsequent vfill and voxel operations). If a new size is given, replace the existing content with a zero-filled N x N x N grid. If a grid with this name does not already exist, allocate an N x N x N grid (default N=100), zero the contents, and mark it as active. Note that grid names must begin with '$'.

show vgrid lists all currently defined voxel grids. Example output:

$vgrid1: (active)
         size 100 X 100 X 100
         vxrange [-4:4]  vyrange[-4:4]  vzrange[-4:4]
         non-zero voxel values:  min 0.061237 max 94.5604
         number of zero voxels:  992070   (99.21%)

unset vgrid $gridname releases all data structures associated with that voxel grid. The data structures are also released by reset session. The function voxel(x,y,z) returns the value of the active grid point nearest that coordinate. See also splot voxel-grids.

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 projection {xy|xz|yz}
set view {no}equal {xy|xyz}
set view azimuth <angle>
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.

Azimuth

set view azimuth <angle-in-degrees>
The setting of azimuth affects the orientation of the z axis in a 3D graph (splot). At the default azimuth = 0 the z axis of the plot lies in the plane orthogonal to the screen horizontal. I.e. the projection of the z axis lies along the screen vertical. Non-zero azimuth rotates the plot about the line of sight through the origin so that a projection of the z axis is no longer vertical. When azimuth = 90 the z axis is horizontal rather than vertical.

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.

Projection

Syntax:
set view projection {xy|xz|yz}
Rotates the view angles of a 3D plot so that one of the primary planes xy, xz, or yz lies in the plane of the plot. Axis labels and tics positioning is adjusted accordingly; tics and labels on the third axis are disabled. The plot is scaled up to approximately match the size that 'plot' would generate for the same axis ranges. set view projection xy is equivalent to set view map.

Vrange

Syntax: set vrange [vmin:vmax] The range of the parametric variables u and v is useful in two contexts. 1) splot in parametric mode. See set parametric, set isosamples. 2) generating 2-dimension sampled data for either plot or splot using the pseudofile "++". See sampling 2D.

Vxrange

Syntax: set vxrange [vxmin:vxmax]

Establishes the range of x coordinates spanned by the active voxel grid. Analogous commands set vyrange and set vzrange exist for the other two dimensions of the voxel grid. If no explicit ranges have been set prior to the first vclear, vfill, or voxel(x,y,z) = command, vmin and vmax will be copied from the current values of xrange.

Vyrange

See set vxrange

Vzrange

See set vxrange

Walls

Syntax:
set walls
set wall {x0|y0|z0|x1|y1} {<fillstyle>} {fc <fillcolor>}

3D surfaces drawn by splot lie within a normalized unit cube regardless of the x y and z axis ranges. The bounding walls of this cube are described by the planes (graph coord x == 0), (graph coord x == 1), etc. The set walls command renders the walls x0 y0 and z0 as solid surfaces. By default these surfaces are semi-transparent (fillstyle transparent solid 0.5). You can customize which walls are drawn and also their individual color and fill style. If you choose to enable walls, you may also want to use set xyplane 0. Example:

set wall z0 fillstyle solid 1.0 fillcolor "gray"

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. See also 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
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.

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

Time

set xdata time indicates that the x coordinate represents a date or time to millisecond precision. There is an analogous command set ydata time.

There are separate format mechanisms for interpretation of time data on input and output. Input data is read from a file either by using the global timefmt or by using the function timecolumn() as part of the plot command. These input mechanisms also apply to using time values to set an axis range. See set timefmt, timecolumn.

Example:

set xdata time
set timefmt "%d-%b-%Y"
set xrange ["01-Jan-2013" : "31-Dec-2014"]
plot DATA using 1:2
or
plot DATA using (timecolumn(1,"%d-%b-%Y")):2

For output, i.e. tick labels along that axis or coordinates output by mousing, the function 'strftime' (type "man strftime" on unix to look it up) is used to convert from the internal time in seconds to a string representation of a date. gnuplot tries to figure out a reasonable format for this. You can customize the format using either set format x or set xtics format. See time_specifiers for a special set of time format specifiers. See also time/date for more information.

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. The program may not reserve enough space to the left of the plot to hold long non-rotated ylabel text. You can adjust this with set lmargin.

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

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:]

Extend

set xrange noextend is the same as set autoscale x noextend. See noextend.

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>}"} {{no}enhanced}
          { numeric | timedate | geographic }
          {{no}logscale}
          { 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.

Tic positions are calculated automatically by default or if the autofreq option is given.

A series of tic positions can be specified by giving either a tic interval alone, or a start point, interval, and end point (see xtics series).

Individual tic positions can be specified individually by providing an explicit list of positions, where each position may have an associated text label. See xtics list.

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.

The appearance of the tics (line style, line width etc.) is determined by the border line (see set border), even if the tics are drawn at the axes.

Xtics series

Syntax:
set xtics <incr>
set xtics <start>, <incr>, <end>
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

Xtics list

Syntax:
set xtics {add} ("label1" <pos1> <level1>, "label2" <pos2> <level2>, ...)

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.

The label is a string enclosed by quotes or a string-valued expression. It may contain formatting information for converting the position into its label, such as "%3f clients", or it may be the empty string "". 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.

Xtics timedata

Times and dates are stored internally as a number of seconds.

Input: Non-numeric time and date values are converted to seconds on input using the format specifier in timefmt. Axis positions and range limits also may be given as quoted dates or times interpreted using timefmt. If the <start>, <incr>, <end> form is used, <incr> must be in seconds. Use of timefmt to interpret input data, range, and tic positions is triggered by set xdata time.

Output: Axis tic labels are generated using a separate format specified either by set format or set xtics format. By default the usual numeric format specifiers are expected (set xtics numeric). Other options are geographic coordinates (set xtics geographic), or times or dates (set xtics time).

Note: For backward compatibility with earlier gnuplot versions, the command set xdata time will implicitly also do set xtics time, and set xdata or unset xdata will implicitly reset to set xtics numeric. However you can change this with a later call to set xtics.

Examples:

set xdata time           # controls interpretation of input data
set timefmt "%d/%m"      # format used to read input data
set xtics timedate       # controls interpretation of output format
set xtics format "%b %d" # format used for tic labels
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" time
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.

Geographic

set xtics geographic indicates that x-axis values are to be interpreted as a geographic coordinate measured in degrees. Use set xtics format or set format x to specify the appearance of the axis tick labels. 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 the xtics are left in the default state (set xtics numeric) the coordinate will be reported as a decimal number of degrees, and format will be assumed to contain normal numeric format specifiers rather than the special set above.

To output degrees/minutes/seconds in a context other than axis tics, such as placing labels on a map, you can use the relative time format specifiers %tH %tM %tS for strptime. See time_specifiers, strptime.

Xtics logscale

If the logscale attribute is set for a tic series along a log-scaled axis, the tic interval is interpreted as a multiplicative factor rather than a constant. For example:
# generate a series of tics at y=20 y=200 y=2000 y=20000
set log y
set ytics 20, 10, 50000 logscale
Note that no tic is placed at y=50000 because it is not in the series 2*10^x. If the logscale property is disabled, the tic increment will be treated as an additive constant even for a log-scaled axis. For example:
# generate a series of tics at y=20 y=40 y=60 ... y=200
set log y
set yrange [20:200]
set ytics 20 nologscale
The logscale attribute is set automatically by the set log command, so normally you do not need this keyword unless you want to force a constant tic interval as in the second example above.

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 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. See also 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>}
                             {linecolor | lc <colorspec>}
                             {dashtype | dt <dashtype>} }
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>, width <line_width>, color <colorspec>, and dash type <dashtype> (if supported by the terminal driver currently in use), or a user-defined style <line_style> (see set style line).

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.

Copyright 1986 - 1993, 1998, 2004 Thomas Williams, Colin Kelley
Distributed under the gnuplot license (rights to distribute modified versions are withheld).