Previous: title, Up: plot


3.14.9 with

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>}
                             {fill | fs <fillstyle>}
                             {nohidden3d} {nocontours} {nosurface}
                             {palette}}
                        }
     

where <style> is one of

          lines        dots       steps     errorbars     xerrorbar    xyerrorlines
          points       impulses   fsteps    errorlines    xerrorlines  yerrorbars
          linespoints  labels     histeps   financebars   xyerrorbars  yerrorlines
                                            vectors

or

           boxes            candlesticks   image      circles
           boxerrorbars     filledcurves   rgbimage
           boxxyerrorbars   histograms     rgbalpha   pm3d
     

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.

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 pointsize for details. But note that both <point_size> as set here and as set by 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 <line_style> 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 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. A palette color value can also be read from an explicitly specified input column in the using specifier. See `colors`, palette, `linetype`.

The keyword `nohidden3d` applies only to plots made with the `splot` command. Normally the global option 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 contour is active.

Similarly, the keyword `nosurface` will turn off the 3D surface for an individual plot even if the global property 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 [ ] [-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