Vous êtes sur la page 1sur 2

PGPLOT FAQ

1 of 2

http://users.monash.edu.au/~dprice/splash/pgplot.html

home publications research software

Home
About

PGPLOT is no longer necessary in SPLASH 2.0. This FAQ is kept for historical interest and as a resource for other
people on the internet still using PGPLOT.

Download
Mailing Lists
FAQ

giza is a modern, drop-in replacement for PGPLOT I have written with a


nearly feature-complete implementation of the PGPLOT API. It provides
link-time compatible replacements for both libpgplot and libcpgplot.
Download giza here.

Gallery
Userguide
How do you get/install PGPLOT? What is PGPLOT anyway?
PGPLOT is a library of Fortran (77) routines for plotting applications. It can be downloaded from
22nd Oct 2015:
v2.6.0 released.

http://www.astro.caltech.edu/~tjp/pgplot/. The PGPLOT libraries were widely used in Astronomy in particular.


Mac OS/X: PGPLOT and gfortran (Fortran compiler) are available via Macports.

29th Jan 2015:


v2.5.1 released.
22nd Aug 2014:
v2.5.0 released.
1st Apr 2014:
v2.4.1 released.

When compiling PGPLOT with g95 on my mac, I get the following errors:
ld: Undefined symbols:
_fprintf$LDBLStub
_printf$LDBLStub
_sprintf$LDBLStub

solution: add -lSystemStubs to the F90FLAGS= in the Makefile


21st Feb 2014:
v2.4.0 released.
more

When I go to plot something, I get errors like:


%PGPLOT, Unable to read font file: grfont.dat
%PGPLOT, Use environment variable PGPLOT_FONT to specify the location of the PGPLOT grfont.dat
file.
Graphics device/type (? to see list, default /NULL): /xw
PGPLOT /xw: Couldn't find program "pgxwin_server" in the directory named
PGPLOT /xw: in your PGPLOT_DIR environment variable, or in any directory
PGPLOT /xw: listed in your PATH environment variable.

solution: Set the PGPLOT_DIR environment variable to the install directory (e.g. /sw/lib/pgplot). This should solve both
problems (although see below for problems with the font file on 64 bit machines).
In tcsh this means something like
setenv PGPLOT_DIR /sw/lib/pgplot

in bash this means


export PGPLOT_DIR='/sw/lib/pgplot'

Problems with PGPLOT fonts on 64-bit machines


solution: the PGPLOT font file (grfont.dat) is a binary file which by default comes pre-compiled as a 32-bit binary which
may not be read properly in a 64-bit installation. The solution is to re-build the grfont.dat file using the compiler you have
used to build PGPLOT by typing, in the PGPLOT directory:
rm grfont.dat
make grfont.dat

22/10/2015 16:39

PGPLOT FAQ

2 of 2

http://users.monash.edu.au/~dprice/splash/pgplot.html

assuming of course that you have the permissions to do so (try "sudo rm grfont.dat" and "sudo make grfont.dat").
Problems with PGPLOT fonts and runtime endian changing
solution: the PGPLOT font file (grfont.dat, see above question) is an unformatted binary file read when PGPLOT is first
called. With gfortran-compiled PGPLOT (and SPLASH), changing the endian-ness in SPLASH (either with a compile time
flag or using the GFORTRAN_CONVERT_UNIT environment variable) also affects the grfont.dat file, making it unreadable.
One solution is to compile a grfont.dat file for each endian-ness, using the endian-changing flags for gfortran in the
PGPLOT makefile (ie. add -fconvert=little-endian or -fconvert=big-endian to the flags in the PGPLOT makefile), then
remake the grfont.dat file:
rm grfont.dat
make grfont.dat

(see above problem also). Then make a copy (e.g. mv grfont.dat grfont.dat_little) and use the environment variable
PGPLOT_FONT to point to this file instead of the default grfont.dat
setenv PGPLOT_FONT /mypgplotdir/pgplot/grfont.dat_little

whenever you are trying to read in little-endian.


When selecting the option /xw the program complains that it can't find the "pgxwin_server" program in the directory
specified in the PGPLOT_DIR environment variable.
solution: "pgxwin_server" is just a program which is run the first time you launch a PGPLOT X-window. So if you can find
where it is (e.g. try "locate pgxwin_server"), then you can just launch it (ie. "cd whereveritis; ./pgxwin_server") before
running splash, then the /xw plots will work. Better still, you don't even have to be running the pgxwin_server on the same
machine as you are plotting on. For example, you can run a local version of pgxwin_server (e.g. from your own PGPLOT
installation) which takes the place of a broken version running on a remote machine.
Everything compiles correctly, but when I try to run splash, I get an error like:
splash: error while loading shared libraries: libpgplot.so: cannot open shared object file: No such file or directory

solution: This means that the shared PGPLOT library file (libpgplot.so) cannot be found, most likely because the directory
which contains it is not in the LD_LIBRARY_PATH. To fix this amend the LD_LIBRARY_PATH environment variable
appropriately, ie. insert the following line into your .tcshrc file:
setenv LD_LIBRARY_PATH ${LD_LIBRARY_PATH}:/home/me/pgplot (or wherever you installed pgplot)

or the bash equivalent (in ~/.profile):


export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/home/me/pgplot

Another possibility is that the shared libraries (ie. libpgplot.so) have not been compiled in your PGPLOT installation. The
simplest solution in this case is to link to the static libraries instead (ie. libpgplot.a). In the Makefile the easiest way is to
modify the SYSTEMFILE variable to include the static libraries, e.g.
SYSTEMFILE = system_unix.f90 /usr/local/lib/pgplot/libpgplot.a

or something similar. Note that for static linking you do not need the -lpgplot in the LDFLAGS.

2008-2014 Daniel Price (daniel.price [ @ ] monash dot edu)


Last Modified: 01 Nov 2013
Original design by Andreas Viklund

22/10/2015 16:39

Vous aimerez peut-être aussi