next up previous contents index
Next: Axes Up: Commands Previous: Pause   Contents   Index


Plot

plot 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; splot draws 2D projections of 3D surfaces and data. plot and splot contain many common features; see splot (p. [*]) for differences. Note specifically that although the binary 4#4binary list5#5 variation does work for both plot and splot, there are small differences between these modes.

Syntax:

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

where either a 4#4function5#5 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 (p. [*])).

It is also possible to define functions and parameters on the plot command itself. This is done merely by isolating them from other items with commas.

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
next up previous contents index
Next: Axes Up: Commands Previous: Pause   Contents   Index
2011-11-30