By default, when PyXPlot is used interactively, all plots are displayed on the screen. It is also possible to produce PostScript output, to be read into other programs or embedded into LaTeX documents, as well as a variety of other graphical formats. The set terminal command1 is used to specify the output format that is required, and the set output command is used to specify the file to which output should be directed. For example,
set terminal postscript set output 'myplot.eps' plot 'datafile.dat'
would output a PostScript plot of data from the file datafile.dat to the file myplot.eps.
The set terminal command can also be used to configure various output options within each supported file format. For example, the following commands would produce black-and-white or colour output respectively:
set terminal monochrome set terminal colour
The former is useful for preparing plots for black-and-white publications, the latter for preparing plots for colourful presentations.
Both PostScript and Encapsulated PostScript can be produced. The former is recommended for producing figures to embed into documents, the latter for plots which are to be printed without further processing. The postscript terminal produces the latter; the eps terminal should be used to produce the former. Similarly the pdf terminal produces files in the Portable Document Format (PDF) read by Adobe Acrobat:
set terminal postscript set terminal eps set terminal pdf
It is also possible to produce plots in the gif, png and jpeg graphic formats, as follows:
set terminal gif set terminal png set terminal jpg
More than one of the above keywords can be combined on a single line, for example:
set terminal postscript colour set terminal gif monochrome
To return to the default state of displaying plots on screen, the x11 terminal should be selected:
set terminal x11
After changing terminals, the refresh command2 is especially useful; it reproduces the last plot to have been generated in the newly-selected graphical format. For more details of the set terminal command, including how to produce gif and png images with transparent backgrounds, see Chapter 2.
Footnotes