Credits | Overview | Plotting Styles | Commands | Terminals |
---|
Functions and data may be displayed in one of a large number of styles. The with keyword provides the means of selection.
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>} {arrowstyle | as <arrowstyle_index>} {fill | fs <fillstyle>} {fillcolor | fc <colorspec>} {nohidden3d} {nocontours} {nosurface} {palette}} }
where <style> is one of
lines dots steps vectors yerrorlines points impulses fsteps xerrorbar xyerrorbars linespoints labels histeps xerrorlines xyerrorlines financebars surface arrows yerrorbar parallelaxes
or
boxes boxplot ellipses histograms rgbalpha boxerrorbars candlesticks filledcurves image rgbimage boxxyerror circles fillsteps pm3d polygons isosurface zerrorfill
or
table mask
The first group of styles have associated line, point, and text properties. The second group of styles also have fill properties. See fillstyle. Some styles have further sub-styles. See plotting styles for details of each. Two special styles produce no immediate plot. See set table and with mask. The table style produces tabular output to a text file or data block. A plot component whose style is with mask defines a set of polygonal regions that can be used to mask subsequent plot elements.
A default style may be chosen by set style function and set style data.
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. To see the complete set of line and point types available for the current terminal, type test.
If you wish to choose the line or point type for a single plot, <line_type> and <point_type> 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 <line_width> and <point_size>, which are specified relative to the default values for each terminal. The pointsize may also be altered globally---see set pointsize for details. But note that both <point_size> 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 with points ps 3 will use points three times the 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 <line_style> to the index of the desired style.
Both 2D and 3D plots (plot and splot commands) can use colors from a smooth palette set previously with the command set palette. The color value corresponds to the z-value of the point itself or to a separate color coordinate provided in an optional additional using column. Color values may be treated either as a fraction of the palette range (palette frac) or as a coordinate value mapped onto the colorbox range (palette or palette z). See colorspec, set palette, linetypes.
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 other than surfaces (i.e. lines, dots, labels, ...) of a plot marked nohidden3d will all be drawn, even if they would normally be obscured by other plot elements.
Similarly, the keyword nocontours will turn off contouring for an individual plot even if the global property set contour is active.
Similarly, the keyword nosurface will turn off the 3D surface for an individual plot even if the global property set surface is active.
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 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 y=10
This plots x*x and a color box:
plot x*x, (x>=-5 && x<=5 ? 40 : 1/0) with filledcurve y=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