From Script | Spoken-Tutorial
Jump to: navigation, search


  • Axis : A graph may have up to four labelled axes. Various commands have the name of an axis built into their names, such as set xlabel. Other commands have one or more axis names as options, such as set logscale xy. The names of the four axes for these usages are "x" for the axis along the bottom border of the plot, "y" for the left border, "x2" for the top border, and "y2" for the right border. "z" also occurs in commands used with 3-d plotting.
  • Graph : A plot contains one "graph". A graph is defined by an abscissa and an ordinate, although these need not actually appear on it.A graph may contain one or more "lines".
  • Dummy : The set dummy command changes the default dummy variable names.


     set dummy {<dummy-var>} {,<dummy-var>}
     show dummy

By default, gnuplot assumes that the independent, or "dummy", variable for the plot command is "t" if in parametric or polar mode, or "x" otherwise. Similarly the independent variables for the splot command are "u" and "v" in parametric mode (splot cannot be used in polar mode), or "x" and "y" otherwise.

  • Isosamples : The isoline density (grid) for plotting functions as surfaces may be changed by the set isosamples command.


     set isosamples <iso_1> {,<iso_2>}
     show isosamples

Each function surface plot will have <iso_1> iso-u lines and <iso_2> iso-v lines. If you only specify <iso_1>, <iso_2> will be set to the same value as <iso_1>. By default, sampling is set to 10 isolines per u or v axis.

  • Key :The set key enables a key (or legend) describing plots on a plot.The contents of the key, i.e., the names given to each plotted data set and function and samples of the lines and/or symbols used to represent them, are determined by the title and with options of the {s}plot command. Please see plot title and plot with for more information.


     set key {  left | right | top | bottom | outside | below
              | <position>}
             {Left | Right} {{no}reverse}
             {samplen <sample_length>} {spacing <vertical_spacing>}
             {width <width_increment>}
             {title "<text>"}
             {{no}box { {linestyle | ls <line_style>}
                        | {linetype | lt <line_type>}
                          {linewidth | lw <line_width>}}}
     set nokey
     show key

By default the key is placed in the upper right corner of the graph. The keywords left, right, top, bottom, outside and below may be used to place the key in the other corners inside the graph or to the right (outside) or below the graph. They may be given alone or combined.

Justification of the labels within the key is controlled by Left or Right (default is Right). The text and sample can be reversed (reverse) and a box can be drawn around the key (box {...}) in a specified linetype and linewidth, or a user-defined linestyle. Note that not all terminal drivers support linewidth selection, though.

The length of the sample line can be controlled by samplen. The sample length is computed as the sum of the tic length and <sample_length> times the character width. samplen also affects the positions of point samples in the key since these are drawn at the midpoint of the sample line, even if it is not drawn. <sample_length> must be an integer.

The vertical spacing between lines is controlled by spacing. The spacing is set equal to the product of the pointsize, the vertical tic size, and <vertical_spacing>. The program will guarantee that the vertical spacing is no smaller than the character height.

The <width_increment> is a number of character widths to be added to or subtracted from the length of the string. This is useful only when you are putting a box around the key and you are using control characters in the text. gnuplot simply counts the number of characters in the string when computing the box width; this allows you to correct it.

  • Labels : Arbitrary labels can be placed on the plot using the set label command.


     set label {<tag>} {"<label_text>"} {at <position>}
               {<justification>} {{no}rotate} {font "<name><,size>"}
     set nolabel {<tag>}
     show label

The <position> is specified by either x,y or x,y,z, and may be preceded by first, second, graph, or screen to select the coordinate system. See coordinates for details.

  • Line : A line is a single function or data set. "Line" is also a plotting style.The lines on a graph may have individual names.
  • Page : A "page" or "screen" is the entire area addressable by gnuplot. On a monitor, it is the full screen; on a plotter, it is a single sheet of paper.
  • Parametric :The set parametric command changes the meaning of plot (splot) from normal functions to parametric functions. The command set noparametric restores the plotting style to normal, single-valued expression plotting.
  • Plot : It operates in either rectangular or polar coordinates.It is the primary command for drawing plots with gnuplot. It creates plots of functions and data in many, many ways. plot is used to draw 2-d functions and data.


    plot {<ranges>}
         {<function> | {"<datafile>" {datafile-modifiers}}}
         {axes <axes>} {<title-spec>} {with <style>}
         {, {definitions,} <function> ...}

where either a <function> or the name of a data file enclosed in quotes is supplied. A function is a mathematical expression or a pair of mathematical expressions in parametric mode. The expressions may be defined completely or in part earlier in the stream of gnuplot commands (see user-defined). *Polar : The set polar command changes the meaning of the plot from rectangular coordinates to polar coordinates.

  • Samples : The sampling rate of functions, or for interpolating data, may be changed by the set samples command.


     set samples <samples_1> {,<samples_2>}
     show samples
  • Screen : A screen may contain one or more "plots". A plot is defined by an abscissa and an ordinate, although these need not actually appear on it, as well as the margins and any text written therein.
  • Size : The set size command scales the displayed size of the plot.


     set size {{no}square | ratio <r> | noratio} {<xscale>,<yscale>}
     show size

The <xscale> and <yscale> values are the scaling factors for the size of the plot, which includes the graph and the margins.

  • Splot :It draws 2-d projections of 3-d surfaces and data. Plot and splot contain many common features.
  • style :Default styles are chosen with the set function style and set data style commands. See plot with for information about how to override the default plotting style for individual functions and data sets.
  • Title : A title can be put on the key (title "<text>")---see also syntax for the distinction between text in single- or double-quotes. The key title uses the same justification as do the plot titles.
  • xlabel : The set xlabel command sets the x axis label. Similar commands set labels on the other axes.


     set xlabel {"<label>"} {<xoff>}{,<yoff>} {"{,<size>}"}
     show xlabel

The same syntax applies to x2label, ylabel, y2label and zlabel.

  • xrange :The set xrange command sets the horizontal range that will be displayed. A similar command exists for each of the other axes, as well as for the polar radius r and the parametric variables t, u, and v.


     set xrange [{{<min>}:{<max>}}] {{no}reverse} {{no}writeback}
     show xrange

where <min> and <max> terms are constants, expressions or an asterisk to set autoscaling. If the data are time/date, you must give the range as a quoted string according to the set timefmt format. Any value omitted will not be changed. The same syntax applies to yrange, zrange, x2range, y2range, rrange, trange, urange and vrange.

Contributors and Content Editors