Go to the first, previous, next, last section, table of contents.


How to use plot

The GNU plot filter plot displays GNU graphics metafiles or translates them to other formats. It will take input from files specified on the command line or from standard input. The `-T' option is used to specify the desired output format. Supported output formats include "X", "pnm", "gif", "ai", "ps", "fig", "pcl", "hpgl", "tek", and "meta" (the default).

The metafile format is a device-independent format for storage of vector graphics. By default, it is a binary rather than a human-readable format (see section The Graphics Metafile Format). Each of the graph, pic2plot, tek2plot, and plotfont utilities will write a graphics metafile to standard output if no `-T' option is specified on its command line. The libplot graphics library may also be used to produce metafiles. Metafiles may contain arbitrarily many pages of graphics, but each metafile produced by graph contains only a single page.

plot, like the metafile format itself, is useful if you wish to preserve a vector graphics file, and display or edit it with more than one drawing editor. The following example shows how you may do this.

To produce a plot of data arranged as alternating x and y coordinates in an ASCII file, you may use graph as follows:

graph < ascii_data_file > test.meta

The file `test.meta' will be a single-page graphics metafile. Similarly, to create in metafile format a plot consisting of a simple figure, you may do:

echo 0 0 1 1 2 0 | spline | graph > test.meta

To display any such plot on an X Window System display, you would do

plot -T X test.meta

or

plot -T X < test.meta

To print the plot on a Postscript printer, you would do something like

plot -T ps < test.meta | lpr

To edit it with the free idraw drawing editor, you would do

plot -T ps < test.meta > test.ps
idraw test.ps

To produce a "portable anymap" (a file in PBM, PGM, or PPM format, whichever is most appropriate) you would do

plot -T pnm < test.meta > test.pnm

and to produce a pseudo-GIF file, you would do

plot -T gif < test.meta > test.gif

Similarly, to produce a version of the plot that can be edited with Adobe Illustrator, you would do

plot -T ai < test.meta > test.ai

and to produce a version that can be edited with the free xfig drawing editor, you would do

plot -T fig < test.meta > test.fig
xfig test.fig

Other formats may be obtained by using plot -T pcl, plot -T hpgl, and plot -T tek.

plot may behave differently depending on the environment in which it is invoked. In particular, plot -T ai, plot -T ps, plot -T fig, plot -T pcl, and plot -T hpgl are affected by the environment variable PAGESIZE. plot -T X, plot -T pnm, and plot -T gif are affected by the environment variable BITMAPSIZE. The DISPLAY environment variable affects the operation of plot -T X, and the TERM environment variable affects the operation of plot -T tek. There are also several environment variables that affect the operation of plot -T pcl and plot -T hpgl. For a complete discussion of the effects of the environment on plot, see section Environment variables.


Go to the first, previous, next, last section, table of contents.