Syntax:
with <style> { {linestyle | ls <line_style>} | {{linetype | lt <line_type>} {linewidth | lw <line_width>} {linecolor | lc <colorspec>} {pointtype | pt <point_type>} {pointsize | ps <point_size>} {fill | fs <fillstyle>} {nohidden3d} {palette}} }
where 5#5style6#6 is either lines, points, linespoints, impulses, dots, steps, fsteps, histeps, errorbars, labels, xerrorbars, yerrorbars, xyerrorbars, errorlines, xerrorlines, yerrorlines, xyerrorlines, boxes, histograms, filledcurves, boxerrorbars, boxxyerrorbars, financebars, candlesticks, vectors, image, rgbimage or pm3d. Some of these styles require additional information. See plotting styles (p. ) for details of each style. fill is relevant only to certain 2D plots (currently boxes boxxyerrorbars and candlesticks). Note that filledcurves and pm3d can take an additional option not listed above (the latter only when used in the splot command) -- see their help or examples below for more details.
Default styles are chosen with the set style function and set style data commands.
By default, each function and data file will use a different line type and point type, up to the maximum number of available types. All terminal drivers support at least six different point types, and re-use them, in order, if more are required. The LaTeX driver supplies an additional six point types (all variants of a circle), and thus will only repeat after 12 curves are plotted with points. The PostScript drivers (postscript) supplies a total of 64.
If you wish to choose the line or point type for a single plot, 5#5line_type6#6 and 5#5point_type6#6 may be specified. These are positive integer constants (or expressions) that specify the line type and point type to be used for the plot. Use test to display the types available for your terminal.
You may also scale the line width and point size for a plot by using 5#5line_width6#6 and 5#5point_size6#6, which are specified relative to the default values for each terminal. The pointsize may also be altered globally -- see set pointsize (p. ) for details. But note that both 5#5point_size6#6 as set here and as set by set pointsize multiply the default point size -- their effects are not cumulative. That is, set pointsize 2; plot x w p ps 3 will use points three times default size, not six.
It is also possible to specify pointsize variable either as part of a line style or for an individual plot. In this case one extra column of input is required, i.e. 3 columns for a 2D plot and 4 columns for a 3D splot. The size of each individual point is determined by multiplying the global pointsize by the value read from the data file.
If you have defined specific line type/width and point type/size combinations with set style line, one of these may be selected by setting 5#5line_style6#6 to the index of the desired style.
If gnuplot was built with pm3d support, the special keyword palette is allowed for smooth color change of lines, points and dots in splots. The color is chosen from a smooth palette which was set previously with the command set palette. The color value corresponds to the z-value of the point coordinates or to the color coordinate if specified by the 4th parameter in using. Both 2d and 3d plots (plot and splot commands) can use palette colors as specified by either their fractional value or the corresponding value mapped to the colorbox range. 2d plots can not use palette colors mapped by Z value. See colors (p. ), set palette (p. ), linetype (p. ).
The keyword nohidden3d applies only to plots made with the splot command. Normally the global option set hidden3d applies to all plots in the graph. You can attach the nohidden3d option to any individual plots that you want to exclude from the hidden3d processing. The individual elements (lines, dots, labels, ...) of a plot marked nohidden3d will all be drawn, even if they would normally be obscured by the elements of some other plot.
The keywords may be abbreviated as indicated.
Note that the linewidth, pointsize and palette options are not supported by all terminals.
Examples:
This plots sin(x) with impulses:
plot sin(x) with impulses
This plots x with points, x**2 with the default:
plot x w points, x**2
This plots tan(x) with the default function style, file "data.1" with lines:
plot [ ] [-2:5] tan(x), 'data.1' with l
This plots "leastsq.dat" with impulses:
plot 'leastsq.dat' w i
This plots the data file "population" with boxes:
plot 'population' with boxes
This plots "exper.dat" with errorbars and lines connecting the points
(errorbars require three or four columns):
plot 'exper.dat' w lines, 'exper.dat' notitle w errorbars
Another way to plot "exper.dat" with errorlines (errorbars require three
or four columns):
plot 'exper.dat' w errorlines
This plots sin(x) and cos(x) with linespoints, using the same line type but
different point types:
plot sin(x) with linesp lt 1 pt 3, cos(x) with linesp lt 1 pt 4
This plots file "data" with points of type 3 and twice usual size:
plot 'data' with points pointtype 3 pointsize 2
This plots file "data" with variable pointsize read from column 4
plot 'data' using 1:2:4 with points pt 5 pointsize variable
This plots two data sets with lines differing only by weight:
plot 'd1' t "good" w l lt 2 lw 3, 'd2' t "bad" w l lt 2 lw 1
This plots filled curve of x*x and a color stripe:
plot x*x with filledcurve closed, 40 with filledcurve y1=10
This plots x*x and a color box:
plot x*x, (x>=-5 && x<=5 ? 40 : 1/0) with filledcurve y1=10 lt 8
This plots a surface with color lines:
splot x*x-y*y with line palette
This plots two color surfaces at different altitudes:
splot x*x-y*y with pm3d, x*x+y*y with pm3d at t