Plot

plot is the primary command for drawing plots with gnuplot. It offers many different graphical representations for functions and data. plot is used to draw 2D functions and data. splot draws 2D projections of 3D surfaces and data.

Syntax:

     plot {<ranges>} <plot-element> {, <plot-element>, <plot-element>}

Each plot element consists of a definition, a function, or a data source together with optional properties or modifiers:

     plot-element:
          {<iteration>}
          <definition> | {sampling-range} <function> | <data source>
                       | keyentry
          {axes <axes>} {<title-spec>}
          {with <style>}

The graphical representation of each plot element is determined by the keyword with, e.g. with lines or with boxplot. See plotting styles (p. [*]).

The data to be plotted is either generated by a function (two functions if in parametric mode), read from a data file, or read from a named data block that was defined previously. Multiple datafiles, data blocks, and/or functions may be plotted in a single plot command separated by commas. See data (p. [*]), inline data (p. [*]), functions (p. [*]).

A plot-element that contains the definition of a function or variable does not create any visible output, see third example below.

Examples:

     plot sin(x)
     plot sin(x), cos(x)
     plot f(x) = sin(x*a), a = .2, f(x), a = .4, f(x)
     plot "datafile.1" with lines, "datafile.2" with points
     plot [t=1:10] [-pi:pi*2] tan(t), \
          "data.1" using (tan($2)):($3/$4) smooth csplines \
                   axes x1y2 notitle with lines 5
     plot for [datafile in "spinach.dat broccoli.dat"] datafile

See also show plot (p. [*]).


Subsections