% 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:
% f77 filename.f -Wl-aarchive,-L/usr/local/lib/pgplot,-L/usr/lib/X11R5 \
-lpgplot -lX11 -o filename.x
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.
% cd /usr/local/lib/pgplot/Demo
% setenv PGPLOT_DIR /usr/local/lib/pgplot
% setenv PGPLOT_DEV /xwin
% pgdemo1
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)