PGPLOT driver for PostScript printers

The PostScript page description language is widely used for desktop publishing. PostScript files can be printed on many laser printers and photo-typesetters, and they can also be viewed on most workstations (e.g., use ghostview on UNIX workstations, pageview on Sun workstations, view/format=ps/interface=decw on VMS workstations). A single-page PGPLOT PostScript file is valid ``encapsulated PostScript'' and can be included in another file by way of a page-composition program. PGPLOT generates level-1 PostScript which is accepted by all PostScript printers. PostScript is a trademark of Adobe Systems Incorporated.

Device type code

``Color'' PostScript files can be printed on monochrome printers: the colors will be rendered as shades of grey. Use the monochrome codes (/PS, /VPS) when you know that the file is to be printed only on monochrome printers.

Default file name

If a file name of - is specified (e.g., -/PS) the PostScript file is sent to the standard output stream (stdout in UNIX).

Default view surface dimensions

10.5 inches horizontal by 7.8 inches vertical (landscape mode); 7.8 inches horizontal by 10.5 inches vertical (portrait mode). These dimensions can be changed with environment variables.


The driver uses coordinate increments of 0.001 inch, giving an ``apparent'' resolution of 1000 pixels/inch. The true resolution is device-dependent; e.g., on an Apple LaserWriter it is 300 pixels/inch (in both dimensions).

Color capability

Color indices 0--255 are supported, and the color representation can be changed with routine PGSCR. With device types /PS and /VPS, color index 0 is white (erase or background color), indices 1--13 are black, 14 is light grey, and 15 is dark grey; while with device types /CPS and /VCPS, color index 0 is white (erase or background color), index 1 is black, and indices 2--15 have the standard PGPLOT color assignments.

File format

The file contains variable length records (maximum 132 characters) containing PostScript commands. The commands use only printable ASCII characters, and the file can be examined or modified with a text editor.

Obtaining hardcopy

Use the operating system print or copy command to send the file to a suitable PostScript printer.

Environment variables

PGPLOT_PS_WIDTH (default 7800)
PGPLOT_PS_HEIGHT (default 10500)
PGPLOT_PS_HOFFSET (default 350)
PGPLOT_PS_VOFFSET (default 250)
These variables tell PGPLOT how big an image to produce. The defaults are appropriate for 8.5 x 11-inch paper. The maximum dimensions of a PGPLOT image are WIDTH by HEIGHT, with the lower left corner offset by HOFFSET horizontally and VOFFSET vertically from the lower left corner of the paper. The units are milli-inches. The ``top'' of the paper is the edge that comes out of the printer first.
If this variable is defined (with any value), the user name, date and time are written in the bottom right corner of each page.
Normally, PGPLOT computes the bounding box for the entire plot (the smallest rectangle that includes all the graphics) as it creates the PostScript file, and writes this information in a %%BoundingBox comment in the file trailer. Some programs that read encapsulated PostScript files expect to find the %%BoundingBox comment in the file header, not the trailer, and may not display the plot correctly. To fix this problem, you may need to move the comment from the trailer to the header with a text editor or special program. Alternatively, you can define PGPLOT_PS_BBOX = MAX. This tells PGPLOT to put a %%BoundingBox comment in the header of the PostScript file; the bounding box is one which encompasses the whole plottable area, not a minimal one, because PGPLOT does not know the correct bounding box until it has finished writing the file.
If this variable is set, the bounding box (the smallest rectangle that includes all the graphics) is drawn on each page.
If this variable is set, the text of each plotted character string is included in the PostScript file as a comment before the sequence of vectors that represents the string. This makes the file slightly larger, but it can be useful if you want to edit the PostScript file.
Normally the output file does not contain special end-of-file characters. But if environment variable PGPLOT_PS_EOF is defined (with any value) PGPLOT writes a control-D job-separator character at the beginning and at the end of the file. This is appropriate for Apple LaserWriters using the serial interface, but it may not be appropriate for other PostScript devices.
Specify NO to suppress use of a PostScript font for the graph markers; markers are then emulated by line-drawing. If this option is not requested, PGPLOT graph markers are scaled geometrically with the character-height attribute and the line-width attribute is ignored. This is different from most of the other drivers, where the line-width used for markers is set by the line-width attribute rather than the character-height attribute. Requesting this option makes the PostScript driver behave like the other drivers, but it also makes the PostScript files larger.

Document Structuring Conventions

The PostScript files conform to Version 3.0 of the Adobe Document Structuring Conventions (see ref.3) and to version 3.0 of the encapsulated PostScript file (EPSF) format. This should allow the files to be read by other programs that accept the EPSF format. Note, though, that multi-page plots are not valid EPSF files. The files do not contain a screen preview section. A device-independent screen preview can be added to PGPLOT files with the program ps2epsi by George Cameron, available with the GhostScript PostScript interpreter from Aladdin Enterprises.

Note that a valid EPSF file should have a %%BoundingBox comment in the header of the file. By default, PGPLOT puts the comment in the trailer of the file, where some but not all programs will find it. You may need to move this comment into the file header using a text editor or special program. See also the discussion of the environment variable PGPLOT_PS_BBOX above.


  1. Adobe Systems, Inc.: PostScript Language Reference Manual. Addison-Wesley, Reading, Massachusetts, 1985.
  2. Adobe Systems, Inc.: PostScript Language Tutorial and Cookbook. Addison-Wesley, Reading, Massachusetts, 1985.
  3. Adobe Systems, Inc.: PostScript Language Reference Manual, Second Edition. Addison-Wesley, Reading, Massachusetts, 1990.


T. J. Pearson, 1991--1995.