How to install PGPLOT
Table of Contents
- Purpose of PGPLOT within Seitosh
- PGPLOT driver configuration
Purpose of PGPLOT within Seitosh
PGPLOT is a Fortran graphics library for scientific data display. Many programs in this repository make use of PGPLOT either directly in Fortran or through the C++ API libpgplotxx. PGPLOT supports output to many different devices, including interactive screen plots as well as Postscript files. In the early days PGPLOT was attractive in particular due to his ability to produce interactive screen plots from Fortran 77 on Tektronix terminals (well, this is history: http://en.wikipedia.org/wiki/Tektronix_4010).
Detailed installation instructions are provided at http://www.astro.caltech.edu/~tjp/pgplot/install.html with specific notes for UNIX systems.
Quick installation guide for use with Seitosh
Download pgplot5.2.tar.gz from http://www.astro.caltech.edu/~tjp/pgplot/ (download address is ftp://ftp.astro.caltech.edu/pub/pgplot/pgplot5.2.tar.gz)
Extract tar file
tar xvfpsz pgplot5.2.tar.gz
mv pgplot pgplot5.2.2
The contents of the archive now are available in
We call this the ''source-code directory''. Any other directory name or path for the ''source-code directory'' will do as well, just use its name consistently throughout the installation process.
PGPLOT does not come with
gfortransupport. To use
gfortranto compile PGPLOT, you might like to copy one of the files in contrib/pgplot to
- gfortran_gcc.conf uses standard system library paths
gfortran_gcc_64.conf uses path names
lib64to refer to X11 and TK libraries (this is necessary on 64bit systems to links against the 64bit version of the binary library instead of the 32bit version). Edit the files to match your system configuration
Create the library directory
mkdir -pv ~/repo/pgplot/linuxgfortran
We call this the ''installation directory''. This will be the initial place for the readily compiled binary libraries, binary executables, font files, and documentation. Any other directory name or path for the ''installation directory'' will do as well, just use its name consistently throughout the installation process.
Change your working directory to the ''installation directory'':
Copy driver list from the ''source-code directory'' to the ''installation directory'':
~/repo/pgplot/linuxgfortran> cp -vpd ~/repo/pgplot/pgplot5.2.2/drivers.list .
Activate drivers by removing exclamation mark in first column for the following drivers in the copy of
NUDRIV 0 /NULL Null device (no output) Std F77 PSDRIV 1 /PS PostScript printers, monochrome, landscape Std F77 PSDRIV 2 /VPS Postscript printers, monochrome, portrait Std F77 PSDRIV 3 /CPS PostScript printers, color, landscape Std F77 PSDRIV 4 /VCPS PostScript printers, color, portrait Std F77 TTDRIV 5 /XTERM XTERM Tektronix terminal emulator Std F77 XWDRIV 1 /XWINDOW Workstations running X Window System C XWDRIV 2 /XSERVE Persistent window on X Window System C
Further drivers may be activated but some of them require special prerequisites. See comments in the ''source-code directory'' for details.
~/repo/pgplot/pgplot5.2.2/makemake ~/repo/pgplot/pgplot5.2.2 linux gfortran_gcc
Use different option if required by your system (like
This and the following steps have to be done with the ''installation directory'' being the current working directory! If you miss to do so and for example issue the commands in the ''source-code directory'' the installation apparently will procede, but will be incomplete at the end.
maketo compile Fortran library.
~/repo/pgplot/pgplot5.2.2/makehtmlto use correct path to perl binary.
make pgplot.htmlcompile HTML documentation.
make cpgto prepare C bindings.
make cleanto remove binary object files.
Install library files in place
/bin/cp -vpd lib* $LOCLIBDIR /bin/cp -vpd cpgplot.h $LOCINCLUDEDIR
PGPLOT_DIRpoints to your ''installation directory''. See the notes at
Preparing for installation of binary programs of Seitosh for comments on
- You may use any other path alterantively to
~/repo/pgplot/pgplot5.2.2for ''source-code directory'' and
~/repo/pgplot/linuxgfortranfor the ''installation directory'', respectively. Just adjust all path names in the above commands consistently.
- For more details see
install-unix.txtand other files in the ''source-code directory''.
At least two environment variables
must be set appropriately to use PGPLOT together with source code from the Seitosh repository.
See also README.compile.
A template bashrc is provided in
This variable contains the path of the PGPLOT ''installation directory''.
This variable is required to pass the location of the binary library to the
linker and the location of the
pgxwin_server binary executable as well
as the location of the font file to the programs at run-time.
See also the last item in the quick installation guide above.
This variable is required for all programs making use of graphical output
through the PGPLOT library. It is passed to the linker in cases where
binaries have to be linked against PGPLOT. Use this variable to pass the
location of your X11 libraries as well as the names of additional
libraries that might be needed for the PGPLOT drivers in your installation
libpng.a by adding -lpng for example).
In case you are in doubt regaring additional libraries, the makefile in your PGPLOT installation directory can be helpful. The variable
in the makefile contains settings required in
TF_LINK_PGPLOT should additionally contain the X11 library (variable
in the PGPLOT makefile) and the path to your PGPLOT installation
directory (as provided by variable
export TF_LINK_PGPLOT="-lpgplot -lX11 -L/usr/X11/lib -L$PGPLOT_DIR"
This variable is required when C or C++ programs must be linked against
Fortran libraries. It defines the linker option for interlanguage linking.
If you use g77, you will have to link against
libg2c.a here (use
then instead of
Since PGPLOT is a Fortran library, this variable is used wherever a C oder C++ program uses PGPLOT.
PGPLOT driver configuration
PGPLOT comes with many different drivers to produce graphics on screen or in a file. These drivers can be configured. The collection of drivers is documented at http://www.astro.caltech.edu/~tjp/pgplot/devices.html Some general configurations options can be selected through environment variables. Some of these settings are prepared in SeitoshBashrc.
X Window driver
The X window driver can be configured by settings in
See http://www.astro.caltech.edu/~tjp/pgplot/xwdriv.html for details.
The postscript driver can be configured by setting environment variables. Appropriate settings are prepared in SeitoshBashrc. See http://www.astro.caltech.edu/~tjp/pgplot/psdriv.html for details.
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. If you want to get rid of the ident marker in the bottom right corner you have to issue
in your shell before prior to calling the plot program.
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
%%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.