PGPLOT Fortran Graphics Library


WWW Manual from Cal Tech site

Appendix A. Alphabetic Routine Listing (Local)

Running PGPLOT Programs

Compiling PGPLOT Programs

Devices in the Local PGPLOT Library

Locally Grown Example PGPLOT Programs

Distributed Example PGPLOT Programs


Running programs compiled with PGPLOT

To run the demo and other PGPLOT programs, you must

% setenv PGPLOT_DIR /usr/local/lib/pgplot

Putting the above into your ~/.cshrc file is encouraged. It is also recommended to specify a default plotting device via

% setenv PGPLOT_DEV device

prior to running a PGPLOT based program, but perhaps not in your ~/.cshrc file. Some common device names are:

/XWINDOW
create a new window on an X console
/XTERM
use the Tek 4010 emulation feature of a standard xterm
/TK4100
color Tek 4105,4107 emulation, e.g. VersaTerm Pro via dialup
/TK4010
mono Tek 4010 emulation, e.g. PC-Plot, other terminal emulators

filename.ps/PS
landscape PostScript output in filename.ps
filename.ps/VPS
portrait PostScript output in filename.ps

filename.gif/GIF
landscape GIF output in filename.gif
filename.gif/VGIF
portrait GIF output in filename.gif

This way to the compleat local device list

Top

Compiling programs with PGPLOT calls

Compiling programs with calls to the PGPLOT library requires a reference to the location and name of the library file and the X11 library file when creating the executable; the following is recommended under HP-UX:

% f77 filename.f -Wl-aarchive,-L/usr/local/lib/pgplot,-L/usr/lib/X11R5 \
-lpgplot -lX11 -o filename.x


EXAMPLES

Simple minimal example

Adding the following snippet of code to an existing program provided a popup window showing the agreement of a non-linear least squares fit to the observed data, displaying the final coefficients on the plot:
      integer    PGOPEN
      real ymx,ymn,yc, rtz(nobs),rfz(nobs),rz(nobs)
      character*80 str
         :
         :
      IF (PGOPEN(' ') .LE. 0) STOP
      CALL PGSCH(1.5)
      CALL PGENV(-6.,6.,ymn,ymx,0,1)
      str = '\frDPPC Gel, NPA; Marcjela-Radic Fit'
      CALL PGLAB('\frZ','\fr\gy', str)

C SHOW THE FINAL COEFFICIENTS ON THE PLOT; YMX IS THE MAX ABCISSA VALUE
C YC IS 1/10 THE DYNAMIC RANGE OF THE ABCISSA, E.G.  0.1*(ymx-ymn)
C NOTE THE USAGE OF PGTEXT ESCAPE SEQUENCES, I.E.
C    \fr   ROMAN FONT
C    \g    GREEK EQUIVALENT
C    \d    DOWN
C    \u    IP

      write (str,941) cf(1)
  941 format ('\fr\gy\do\u = ',G12.5E2)
      CALL PGTEXT( 0.75, ymx-yc, str)
      write (str,942) cf(2)
  942 format ('\frh = ',G12.5E2)
      CALL PGTEXT( 0.75, ymx-2*yc, str)
      write (str,943) cf(3)
  943 format ('\fr\gl = ',G12.5E2)
      CALL PGTEXT( 0.75, ymx-3*yc, str)
      write (str,944) rms
  944 format ('\frRMS = ',G12.5E2)
      CALL PGTEXT( 0.75, ymx-4*yc, str)

C THE OBSERVED DATA IS IN THE 1-D ARRAY RFZ, THE FIT IN RTZ

      CALL PGSCH(1.0)
      CALL PGPT(nobs, rz, rfz, 16)
      CALL PGSLW(3)
      CALL PGLINE(nobs, rz, rtz)
      CALL PGCLOS

A slightly more complicated example is the Fortran source code for a complete program which fetches two filenames passed as arguments and makes an over/under plot, i.e. data plotted in two different viewports.

Top


Fortran Source for Examples Distributed With PGPLOT

The demo programs and their source code are located in /usr/local/lib/pgplot/Demo (be sure to set the PGPLOT_DIR environment variable). The source files for the first 2 demos are a good place to start, after first running those programs, via e.g.:

% cd /usr/local/lib/pgplot/Demo
% setenv PGPLOT_DIR /usr/local/lib/pgplot
% setenv PGPLOT_DEV /xwin
% pgdemo1

Top


Devices Included Locally

Device types which produce an output file may have a filename before the / char, e.g. filename.ps/PS
 PGPLOT v5.1.0 Copyright 1996 California Institute of Technology
 Device types available:
 /EXCL  (Talaris/EXCL printers, landscape)
 /VEXCL (Talaris/EXCL printers, portrait)
 /GIF   (Graphics Interchange Format file, landscape orientation)
 /VGIF  (Graphics Interchange Format file, portrait orientation)
 /HPGL  (Hewlett Packard HPGL plotter, landscape orientation)
 /VHPGL (Hewlett Packard HPGL plotter, portrait orientation)
 /HJ    (Hewlett-Packard PCL for LaserJet, LaserJet II, DeskJet 500)
 /LATEX (LaTeX picture environment)
 /FILE  (PGPLOT graphics metafile)
 /NULL  (Null device, no output)
 /PPM   (Portable Pixel Map file, landscape orientation)
 /VPPM  (Portable Pixel Map file, portrait orientation)
 /PS    (PostScript file, landscape orientation)
 /VPS   (PostScript file, portrait orientation)
 /CPS   (Colour PostScript file, landscape orientation)
 /VCPS  (Colour PostScript file, portrait orientation)
 /XTERM (XTERM Tek terminal emulator)
 /TEK4010 (Tektronix 4010 terminal)
 /KRM3  (Kermit 3 IBM-PC terminal emulator)
 /TK4100 (Tektronix 4100 terminals)
 /TX    (TeX PK Font generation)
 /WD    (X Window Dump file, landscape orientation)
 /VWD   (X Window Dump file, portrait orientation)
 /XWINDOW (X window window@node:display.screen/xw)
 /XSERVE  (A /XWINDOW window that persists for re-use)

Top