
- •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 |
171 |
Splot surfaces
splot can display a surface as a collection of points, or by connecting those points. As with plot, the points may be read from a data le or result from evaluation of a function at speci ed intervals, see set isosamples (p. 117). The surface may be approximated by connecting the points with straight line segments, see set surface (p. 151), in which case the surface can be made opaque with set hidden3d. The orientation from which the 3d surface is viewed can be changed with set view.
Additionally, for points in a grid format, splot can interpolate points having a common amplitude (see set contour (p. 105)) and can then connect those new points to display contour lines, either directly with straight-line segments or smoothed lines (see set cntrparam (p. 102)). Functions are already evaluated in a grid format, determined by set isosamples and set samples, while le data must either be in a grid format, as described in datale, or be used to generate a grid (see set dgrid3d (p. 109)).
Contour lines may be displayed either on the surface or projected onto the base. The base projections of the contour lines may be written to a le, and then read with plot, to take advantage of plot's additional formatting capabilities.
Stats (Statistical Summary)
Syntax:
stats 'filename' [using N[:M]] [name 'prefix'] [[no]output]]
This command prepares a statistical summary of the data in one or two columns of a le. The using speci er is interpreted in the same way as for plot commands. See plot (p. 72) for details on the index (p. 79), every (p. 78), and using (p. 83) directives. Data points are ltered against both xrange and yrange before analysis. See set xrange (p. 159). The summary is printed to the screen by default. Output can be redirected to a le by prior use of the command set print, or suppressed altogether using the nooutput option.
In addition to printed output, the program stores the individual statistics into three sets of variables. Therst set of variables reports how the data is laid out in the le:
STATS_records |
# total number of in-range data records |
STATS_outofrange |
# number of records filtered out by range limits |
STATS_invalid |
# number of invalid/incomplete/missing records |
STATS_blank |
# number of blank lines in the file |
STATS_blocks |
# number of indexable data blocks in the file |
The second set reports properties of the in-range data from a single column. If the corresponding axis is autoscaled (x-axis for the 1st column, y-axis for the optional second column) then no range limits are applied. If two columns are being analysed in a single stats command, the the su x " x" or " y" is appended to each variable name. I.e. STATS min x is the minimum value found in the rst column, while STATS min y is the minimum value found in the second column.
STATS_min |
# minimum value of in-range data points |
STATS_max |
# maximum value of in-range data points |
STATS_index_min |
# index i for which data[i] == STATS_min |
STATS_index_max |
# index i for which data[i] == STATS_max |
STATS_lo_quartile |
# value of the lower (1st) quartile boundary |
STATS_median |
# median value |
STATS_up_quartile |
# value of the upper (3rd) quartile boundary |
STATS_mean |
# mean value of in-range data points |
STATS_stddev |
# standard deviation of the in-range data points |
STATS_sum |
# sum |
STATS_sumsq |
# sum of squares |
The third set of variables is only relevant to analysis of two data columns.
STATS_correlation |
# |
correlation coefficient between |
x |
and y values |
STATS_slope |
# |
A corresponding to a linear fit |
y |
= Ax + B |

172 |
gnuplot 4.6 |
STATS_intercept |
# B corresponding to a linear fit y = Ax + B |
STATS_sumxy |
# sum of x*y |
STATS_pos_min_y |
# x coordinate of a point with minimum y value |
STATS_pos_max_y |
# x coordinate of a point with maximum y value |
It may be convenient to track the statistics from more than one le at the same time. The name option causes the default pre x "STATS" to be replaced by a user-speci ed string. For example, the mean value of column 2 data from two di erent les could be compared by
stats "file1.dat" using 2 name "A" stats "file2.dat" using 2 name "B" if (A_mean < B_mean) {...}
The index reported in STATS index xxx corresponds to the value of pseudo-column 0 ($0) in plot commands. I.e. the rst point has index 0, the last point has index N-1.
Data values are sorted to nd the median and quartile boundaries. If the total number of points N is odd, then the median value is taken as the value of data point (N+1)/2. If N is even, then the median is reported as the mean value of points N/2 and (N+2)/2. Equivalent treatment is used for the quartile boundaries.
For an example of using the stats command to help annotate a subsequent plot, see
stats.dem.
The current implementation does not allow analysis if either the X or Y axis is set to log-scaling. This restriction may be removed in a later version.
System
system "command" executes "command" using the standard shell. See shell (p. 167). If called as a function, system("command") returns the resulting character stream from stdout as a string. One optional trailing newline is ignored.
This can be used to import external functions into gnuplot scripts:
f(x) = real(system(sprintf("somecommand %f", x)))
Test
This command graphically tests or presents terminal and palette capabilities.
Syntax:
test {terminal | palette [rgb|rbg|grb|gbr|brg|bgr]}
test or test terminal creates a display of line and point styles and other useful things appropriate for and supported by the terminal you are just using.
test palette plots pro les of R(z),G(z),B(z), where 0<=z<=1. These are the RGB components of the current color palette. It also plots the apparent net intensity as calculated using NTSC coe cients to map RGB onto a grayscale. The optional parameter, a permutation of letters rgb, determines the sequence in which the r,g,b pro les are drawn.
Unde ne
Clear one or more previously de ned user variables. This is useful in order to reset the state of a script containing an initialization test.
A variable name can contain the wildcard character * as last character. If the wildcard character is found, all variables with names that begin with the pre x preceding the wildcard will be removed. This is useful to
gnuplot 4.6 |
173 |
remove several variables sharing a common pre x. Note that the wildcard character is only allowed at the end of the variable name! Specifying the wildcard character as sole argument to unde ne has no e ect.
Example:
undefine foo foo1 foo2
if (!exists("foo")) load "initialize.gp"
bar = 1; |
bar1 |
= 2; bar2 = 3 |
undefine |
bar* |
# removes all three variables |
Unset
Options set using the set command may be returned to their default state by the corresponding unset command. The unset command may contain an optional iteration clause. See iteration (p. 70).
Examples:
set xtics mirror rotate by -45 0,10,100
...
unset xtics
# Unset labels numbered between 100 and 200 unset for [i=100:200] label i
Update
This command writes the current values of the t parameters into the given le, formatted as an initial-valuele (as described in the tsection). This is useful for saving the current values for later use or for restarting a converged or stopped t.
Syntax:
update <filename> {<filename>}
If a second lename is supplied, the updated values are written to this le, and the original parameter le is left unmodi ed.
Otherwise, if the le already exists, gnuplot rst renames it by appending .old and then opens a new le. That is, "update 'fred'" behaves the same as "!rename fred fred.old; update 'fred.old' 'fred'". [On DOS and other systems that use the twelve-character " lename.ext" naming convention, "ext" will be "old" and " lename" will be related (hopefully recognizably) to the initial name. Renaming is not done at all on VMS systems, since they use le-versioning.]
Please see t (p. 62) for more information.
While
Syntax:
while (<expr>) { <commands>
}
Execute a block of commands repeatedly so long as <expr> evaluates to a non-zero value. This command cannot be mixed with old-style (un-bracketed) if/else statements. See if (p. 69).