Next: PLOTSTM(1) Up: WFDB Applications Guide Previous: PARSESCP(1)On This Page


plot2d, plot3d - make 2-D or 3-D plots from text files of data, using gnuplot


plot2d [ input-file ] [ [ xcol ] ycol ] [ options ... ]
plot3d [ input-file ] [ [ xcol ycol ] zcol ] [ options ... ]


These UNIX shell scripts can be used to produce simple 2-D and 3-D plots using gnuplot(1) in batch (non-interactive) mode. plot2d was designed as a quick-and-dirty replacement for plt(1) (see ). plot2d accepts a few of the most commonly-used plt options and produces similar plots. plot3d uses the same syntax as plot2d, but it produces simple 3-D plots (a capability not yet offered by plt).

The input-file should contain one or more space- or tab-separated columns of data per line, with each point on a line. Omit the input-file argument to read data from the standard input. (Note: since gnuplot cannot read data from a pipe, plot2d and plot3d save piped input in a temporary file before invoking gnuplot.)

xcol, ycol, and zcol specify the column numbers within the input file for the x, y, and z coordinates of the points to be plotted. The leftmost column is column 0 (this convention follows that used by plt, rather than that used by gnuplot). Omit the xcol argument to plot2d to use row numbers as abscissas; if ycol is also omitted, plot2d plots column 1 vs. column 0. When using plot3d, omit both xcol and ycol to generate x and y coordinates sequentially based on row numbers; a blank line in the input resets x and increments y in this case.

Options include:

Print help and exit (no plot is made).
-t title
Use title as the title for the plot.
-x label
Use label as the X-axis label.
-y label
Use label as the Y-axis label.
-z label
Use label as the Z-axis label (plot3d only).
-X xmin xmax
Plot x-coordinates between xmin and xmax only.
-Y ymin ymax
Plot y-coordinates between ymin and ymax only.
-Z zmin zmax
Plot z-coordinates between zmin and zmax only (plot3d only).
-T printer
Produce output on the specified PostScript printer (default: plot on-screen). Use -T eps to generate encapsulated PostScript on the standard output.


Create a text file with the following contents:
0 0 0

1 1 1

2 4 8

3 9 27

4 16 64

and call the file powers. Plot the first column vs. the second by:
plot2d powers 0 1 -t "Squares of small integers" -x "Integer" -y "Square"

The same file can be used to generate a number of different plots, by choosing different columns. To plot the third column vs. the first, try: plot2d powers 2 0 -t "Marshmallows" -x "Mass (kg)" -y "Height (m)"

See Also

gnuplot(1) , plt(1)


George B. Moody (


Table of Contents

Up: WFDB Applications Guide

Please e-mail your comments and suggestions to, or post them to:

MIT Room E25-505A
77 Massachusetts Avenue
Cambridge, MA 02139 USA

Updated 28 May 2015