
- •Copyright
- •Introduction
- •Seeking-assistance
- •New features
- •New syntax
- •Local customization of linetypes
- •New plot styles
- •Revised polar axes
- •New smoothing algorithms
- •New time/date handling
- •Statistical summary of data
- •New or revised terminal drivers
- •Backwards compatibility
- •Batch/Interactive Operation
- •Canvas size
- •Command-line-editing
- •Comments
- •Coordinates
- •Datastrings
- •Enhanced text mode
- •Environment
- •Expressions
- •Functions
- •Elliptic integrals
- •Random number generator
- •Value
- •Operators
- •Unary
- •Binary
- •Ternary
- •Summation
- •Fonts
- •Cairo (pdfcairo, pngcairo, epscairo, wxt terminals)
- •Gd (png, gif, jpeg terminals)
- •Postscript (also encapsulated postscript *.eps)
- •Glossary
- •Linetypes, colors, and styles
- •Colorspec
- •Linecolor variable
- •Rgbcolor variable
- •Linestyles vs linetypes
- •Mouse input
- •Bind
- •Bind space
- •Mouse variables
- •Plotting
- •Start-up (initialization)
- •String constants and string variables
- •Substitution and Command line macros
- •Substitution of system commands in backquotes
- •Substitution of string variables as macros
- •String variables, macros, and command line substitution
- •Syntax
- •Quote Marks
- •Time/Date data
- •Boxerrorbars
- •Boxes
- •Boxplot
- •Boxxyerrorbars
- •Candlesticks
- •Circles
- •Ellipses
- •Dots
- •Filledcurves
- •Financebars
- •Fsteps
- •Fillsteps
- •Histeps
- •Histograms
- •Newhistogram
- •Automated iteration over multiple columns
- •Image
- •Transparency
- •Image failsafe
- •Impulses
- •Labels
- •Lines
- •Linespoints
- •Points
- •Polar
- •Steps
- •Rgbalpha
- •Rgbimage
- •Vectors
- •Xerrorbars
- •Xyerrorbars
- •Yerrorbars
- •Xerrorlines
- •Xyerrorlines
- •Yerrorlines
- •3D (surface) plots
- •2D projection (set view map)
- •Call
- •Clear
- •Evaluate
- •Exit
- •Adjustable parameters
- •Short introduction
- •Error estimates
- •Statistical overview
- •Practical guidelines
- •Control
- •Control variables
- •Environment variables
- •Multi-branch
- •Starting values
- •Tips
- •Help
- •History
- •Iteration
- •Load
- •Lower
- •Pause
- •Plot
- •Axes
- •Binary
- •General
- •Array
- •Record
- •Skip
- •Format
- •Endian
- •Filetype
- •Keywords
- •Data
- •Every
- •Index
- •Smooth
- •Thru
- •Using
- •Volatile
- •Errorbars
- •Errorlines
- •Functions
- •Parametric
- •Ranges
- •Iteration
- •Title
- •With
- •Quit
- •Raise
- •Refresh
- •Replot
- •Reread
- •Reset
- •Save
- •Set-show
- •Angles
- •Arrow
- •Autoscale
- •Parametric mode
- •Polar mode
- •Bars
- •Bind
- •Bmargin
- •Border
- •Boxwidth
- •Clabel
- •Clip
- •Cntrparam
- •Color box
- •Colornames
- •Contour
- •Data style
- •Decimalsign
- •Dgrid3d
- •Dummy
- •Encoding
- •Fontpath
- •Format
- •Gprintf
- •Function style
- •Functions
- •Grid
- •Hidden3d
- •Historysize
- •Isosamples
- •Key placement
- •Key samples
- •Label
- •Linetype
- •Lmargin
- •Loadpath
- •Locale
- •Logscale
- •Macros
- •Mapping
- •Margin
- •Mouse
- •Doubleclick
- •Mouseformat
- •Scrolling
- •X11 mouse
- •Zoom
- •Multiplot
- •Mx2tics
- •Mxtics
- •My2tics
- •Mytics
- •Mztics
- •Object
- •Rectangle
- •Ellipse
- •Circle
- •Polygon
- •Origin
- •Output
- •Parametric
- •Plot
- •Algorithm
- •Position
- •Scanorder
- •Clipping
- •Hidden3d
- •Interpolate
- •Palette
- •Rgbformulae
- •Functions
- •Cubehelix
- •File
- •Gamma correction
- •Postscript
- •Pointintervalbox
- •Pointsize
- •Polar
- •Psdir
- •Raxis
- •Rmargin
- •Rrange
- •Rtics
- •Samples
- •Size
- •Style
- •Set style arrow
- •Boxplot
- •Set style data
- •Set style function
- •Set style increment
- •Set style line
- •Set style circle
- •Set style rectangle
- •Set style ellipse
- •Surface
- •Table
- •Terminal
- •Termoption
- •Tics
- •Ticslevel
- •Ticscale
- •Timestamp
- •Timefmt
- •Title
- •Tmargin
- •Trange
- •Urange
- •Variables
- •Version
- •View
- •Vrange
- •X2data
- •X2dtics
- •X2label
- •X2mtics
- •X2range
- •X2tics
- •X2zeroaxis
- •Xdata
- •Xdtics
- •Xlabel
- •Xmtics
- •Xrange
- •Xtics
- •Xtics rangelimited
- •Xyplane
- •Xzeroaxis
- •Y2data
- •Y2dtics
- •Y2label
- •Y2mtics
- •Y2range
- •Y2tics
- •Y2zeroaxis
- •Ydata
- •Ydtics
- •Ylabel
- •Ymtics
- •Yrange
- •Ytics
- •Yzeroaxis
- •Zdata
- •Zdtics
- •Zzeroaxis
- •Cbdata
- •Cbdtics
- •Zero
- •Zeroaxis
- •Zlabel
- •Zmtics
- •Zrange
- •Ztics
- •Cblabel
- •Cbmtics
- •Cbrange
- •Cbtics
- •Shell
- •Splot
- •Matrix
- •Grid data
- •Splot surfaces
- •Stats (Statistical Summary)
- •System
- •Test
- •Unset
- •Update
- •While
- •Complete list of terminals
- •Aifm
- •Aqua
- •Cairolatex
- •Canvas
- •Cgm font
- •Cgm fontsize
- •Cgm linewidth
- •Cgm rotate
- •Cgm solid
- •Cgm size
- •Cgm width
- •Cgm nofontlist
- •Context
- •Requirements
- •Calling gnuplot from ConTeXt
- •Corel
- •Debug
- •Dumb
- •Eepic
- •Emxvga
- •Epscairo
- •Epslatex
- •Excl
- •Examples
- •Gpic
- •Grass
- •Hpgl
- •Hpljii
- •Hppj
- •Imagen
- •Jpeg
- •Latex
- •Linux
- •Lua tikz
- •Macintosh
- •METAFONT Instructions
- •Metapost Instructions
- •Next
- •Openstep (next)
- •Pdfcairo
- •Examples
- •Pngcairo
- •Postscript
- •Editing postscript
- •Postscript prologue
- •Postscript adobeglyphnames
- •Pslatex and pstex
- •Pstricks
- •Regis
- •Svga
- •Texdraw
- •Tgif
- •Tikz
- •Tkcanvas
- •Tpic
- •Vgagl
- •Windows
- •Graph-menu
- •Printing
- •Text-menu
- •Wgnuplot.mnu
- •Wgnuplot.ini
- •Xlib
- •Known limitations
- •External libraries
gnuplot 4.6 |
167 |
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
... pm3djpalette can be ltered by using di erent zrange and cbrange.
Please see set xrange (p. 159) for details on set cbrange (p. 167) syntax. See also set palette (p. 137) and set colorbox (p. 104).
Cbtics
The set cbtics command controls major (labelled) tics on the color box axis. Please see set xtics (p. 160) for details.
Shell
The shell command spawns an interactive shell. To return to gnuplot, type logout if using VMS, exit or the END-OF-FILE character if using Unix, or exit if using MS-DOS or OS/2.
There are two ways of spawning a shell command: using system command or via ! ($ if using VMS). The former command takes a string as a parameter and thus it can be used anywhere among other gnuplot commands, while the latter syntax requires to be the only command on the line. Control will return immediately to gnuplot after this command is executed. For example, in MS-DOS or OS/2,
! dir
or
system "dir"
prints a directory listing and then returns to gnuplot. Other examples of the former syntax:
system "date"; set time; plot "a.dat"
print=1; if (print) replot; set out; system "lpr x.ps"
Splot
splot is the command for drawing 3D plots (well, actually projections on a 2D surface, but you knew that). It can create a plot from functions or data read from les in a manner very similar to the plot command. splot provides only a single x, y, and z axis; there is no equivalent to the x2 and y2 secondary axes provided by plot.
See the plot (p. 72) command for many options available in both 2D and 3D plots. Syntax:
splot {<ranges>} {<iteration>}
<function> | "<datafile>" {datafile-modifiers}} {<title-spec>} {with <style>}
{, {definitions{,}} <function> ...}
where either a <function> or the name of a data le enclosed in quotes is supplied. The function can be a mathematical expression, or a triple of mathematical expressions in parametric mode.
By default splot draws the xy plane completely below the plotted data. The o set between the lowest ztic and the xy plane can be changed by set xyplane. The orientation of a splot projection is controlled by set view. See set view (p. 156) and set xyplane (p. 163) for more information.

168 |
gnuplot 4.6 |
The syntax for setting ranges on the splot command is the same as for plot. In non-parametric mode, the order in which ranges must be given is xrange, yrange, and zrange. In parametric mode, the order is urange, vrange, xrange, yrange, and zrange.
The title option is the same as in plot. The operation of with is also the same as in plot, except that the plotting styles available to splot are limited to lines, points, linespoints, dots, and impulses; the error-bar capabilities of plot are not available for splot.
The data le options have more di erences.
See also show plot (p. 133).
Datale
Splot, like plot, can display from a le.
Syntax:
splot '<file_name>' {binary <binary list>} {{nonuniform} matrix} {index <index list>} {every <every list>} {using <using list>}
The special lenames "" and "-" are permitted, as in plot. See speciallenames (p. 81).
In brief, binary and matrix indicate that the data are in a special form, index selects which data sets in a multi-data-set le are to be plotted, every speci es which datalines (subsets) within a single data set are to be plotted, and using determines how the columns within a single record are to be interpreted.
The options index and every behave the same way as with plot; using does so also, except that the using list must provide three entries instead of two.
The plot options thru and smooth are not available for splot, but cntrparam and dgrid3d provide limited smoothing capabilities.
Data le organization is essentially the same as for plot, except that each point is an (x,y,z) triple. If only a single value is provided, it will be used for z, the datablock number will be used for y, and the index of the data point in the datablock will be used for x. If two or four values are provided, gnuplot uses the last value for calculating the color in pm3d plots. Three values are interpreted as an (x,y,z) triple. Additional values are generally used as errors, which can be used by t.
Single blank records separate datablocks in a splot data le; splot treats datablocks as the equivalent of function y-isolines. No line will join points separated by a blank record. If all datablocks contain the same number of points, gnuplot will draw cross-isolines between datablocks, connecting corresponding points. This is termed "grid data", and is required for drawing a surface, for contouring (set contour) and hiddenline removal (set hidden3d). See also splot grid data (p. 170).
It is no longer necessary to specify parametric mode for three-column splots.
Matrix
Gnuplot can interpret matrix input in two di erent ways. The rst of these assumes a uniform grid of x and y coordinates, and assigns each value in the input matrix to one element of this uniform grid. This is the default for ascii data input, but not for binary input. Example commands for plotting uniform matrix data:
splot |
'file' |
matrix |
using 1:2:3 |
# |
ascii input |
splot |
'file' |
binary |
general using 1:2:3 |
# |
binary input |
In a uniform grid matrix the z-values are read in a row at a time, i. e.,
z11 z12 z13 z14 ...
z21 z22 z23 z24 ...
z31 z32 z33 z34 ...

gnuplot 4.6 |
169 |
and so forth.
For ascii input, a blank line or comment line ends the matrix, and starts a new surface mesh. You can select among the meshes inside a le by the index option to the splot command, as usual. The second interpretation assumes a non-uniform grid with explicit x and y coordinates. The rst row of input data contains the y coordinates; the rst column of input data contains the x coordinates. For binary input data, the rst element of the rst row must contain the number of data columns. (This number is ignored for ascii input). Both the coordinates and the data values in a binary input are treated as single precision oats. Example commands for plotting non-uniform matrix data:
splot 'file' nonuniform matrix using 1:2:3 |
# ascii input |
|||||
splot 'file' binary matrix using 1:2:3 |
# binary input |
|||||
Thus the data organization for non-uniform matrix input is |
||||||
<N+1> |
<y0> |
<y1> |
<y2> |
... |
<yN> |
|
<x0> <z0,0> <z0,1> <z0,2> |
... <z0,N> |
|
||||
<x1> <z1,0> <z1,1> <z1,2> |
... <z1,N> |
|
||||
: |
: |
: |
: |
... |
: |
|
which is then converted into triplets:
<x0> <y0> <z0,0> <x0> <y1> <z0,1> <x0> <y2> <z0,2>
: : :
<x0> <yN> <z0,N>
<x1> <y0> <z1,0> <x1> <y1> <z1,1>
:: :
These triplets are then converted into gnuplot iso-curves and then gnuplot proceeds in the usual manner to do the rest of the plotting.
A collection of matrix and vector manipulation routines (in C) is provided in binary.c. The routine to write binary data is
int fwrite_matrix(file,m,nrl,nrl,ncl,nch,row_title,column_title)
An example of using these routines is provided in the le bf test.c, which generates binary les for the demole demo/binary.dem.
Usage in plot:
plot `a.dat` matrix
plot `a.dat` matrix using 1:3
plot 'a.gpbin' {matrix} binary using 1:3
will plot rows of the matrix, while using 2:3 will plot matrix columns, and using 1:2 the point coordinates (rather useless). Applying the every option you can specify explicit rows and columns.
Example { rescale axes of a matrix in an ascii le:
splot `a.dat` matrix using (1+$1):(1+$2*10):3
Example { plot the 3rd row of a matrix in an ascii le:
plot 'a.dat' matrix using 1:3 every 1:999:1:2
(rows are enumerated from 0, thus 2 instead of 3).
Gnuplot can read matrix binary les by use of the option binary appearing without keyword quali cations unique to general binary, i.e., array, record, format, or letype. Other general binary keywords for translation should also apply to matrix binary. (See binary general (p. 73) for more details.)