PostScript driver for PGPLOT

Download here file PGPLOT.PSDRIV.tar.bz2 containing the PosScript driver for PGPLOT

Save this file to disk and unpack (in Linux) with

tar -jxvf PSDRIV.tar.bz2
will create directory PGPLOT.PSDRIV.

The directory PGPLOT.PSDRIV contains a patch for PGPLOT version 5.2 to enable the use of PostScript Fonts. These include extensions to PGPLOT directives and environmental variables. The patch works without change also for PGPLOT version 5.2.2.

Description is in the file psdriv.doc (a normal text file, not a MSWord file).

Note that this is not an official patch, and it may not be fully compatible with all options of pgplot.
But it works fine with the subset of pgplot that I use in flux7.
I submitted it long time ago to Tim Pearson, author of pgplot, but he did not find it acceptable.
But feel free to use it, and maybe do some further work on it.

I would appreciate being informed of any suggestions and improvements to this driver.

Peter Smulders

October 2015 Bug fixed: psdriv.f occasionally accessed data outside array bounds.

backslash behaviour
It seems normal to a Fortran programmer that the character constant '\n' consists of two characters, a backslash and an 'n'.
Not so for GNU Fortran, g77, where the default behaviour is to consider the backslash as an escape character, just like in C and Unix.
Users of g77 or gfortran should modify the makefile in directory /usr/local/pgplot/ and specify

in variables FFLAGC and FFLAGD.

Apparently, in some implementations of Unix f77, the corresponding compiler flag is "-backslash", rather than no-backslash :-)
Anyways, what we want is the '\' to be treated as a normal character.


If the variable PGPLOT_PS_FONT is set to NO then the driver is fully 'backwards compatible'. The patch affects modules psdriv.f and grtext.f

For example of use, see psdemo.f. For example of output, see

To install, replace modules psdriv.f and grtext.f in the PGPLOT source distribution and compile as usual.


The environmental variable PGPLOT_PS_FONT is used to control the PostScript fonts for text strings output by PGPLOT. Specify "NO" to suppress use of PostScript fonts.

The default font family is Times. Another font family may be selected by giving PGPLOT_PS_FONT a specific value, e.g. 'Courier', 'Helvetica', 'NewCentury', 'Zapf'. Fontnames may be truncated to 3 or more letters, and case is ignored; e.g. the values 'NewC' and 'NEW' are equivalent to 'NewCentury'.

imbedded directives

Fonts may also be set by directives imbedded in the text. Unlike other PGPLOT drivers a distinction is made between \fr and \fR, and between \fi and \fI.

 \fi : set Italic font
 \fr : set Roman font
 \fR : set bold font
 \fI : set bold italic font
 \fn : set normal font, acts the same as \fr.

These directives only apply to the remainder of the current string.

In addition a font family may be chosen by directives

 \fT : set font family Times,
 \fH : set font family Helvetica
 \fC : set font family Courier
 \fM : set font family NewCentury, [the n was already taken by normal]
 \fZ : set font family Zapf.

These directives apply to the remainder of the current Page.

Example: the string \fC\fR text1 results in text1 in Courier Bold. The default font for subsequent strings is now Courier.

As a last resort, for PostScript fonts, one can also use the directive \f<n>, where <n> is the character CHAR(N+32), and N is the font's number in the array FONTNAME, defined below.

Some quirks


     0    Symbol
     1    Times-Roman
     2    Times-Italic
     3    Times-Bold
     4    Times-BoldItalic
     5    Helvetica
     6    Helvetica-Oblique
     7    Helvetica-Bold
     8    Helvetica-BoldOblique
     9    Courier
    10    Courier-Oblique
    11    Courier-Bold
    12    Courier-BoldOblique
    13    NewCenturySchlbk-Roman
    14    NewCenturySchlbk-Italic
    15    NewCenturySchlbk-Bold
    16    NewCenturySchlbk-BoldItalic
    17    ZapfChancery
    18    ZapfChancery-Oblique
    19    ZapfChancery-Bold
    20    URWGroteskT-Bold
    21    URWAntiquaT-RegularCondensed
    22    Cyrillic
    23    ZapfDingbats