ソースコードの所在: /home/kizu/pgplot/samples/pgex22.f
(このプログラムで描ける絵は、こちら)
PROGRAM PGEX22
C-----------------------------------------------------------------------
C Demonstration program for the PGPLOT plotting package.
C Plot a table of the standard PGPLOT graph marker symbols. This
C program also illustrates how windows and viewports may be manipulated.
C-----------------------------------------------------------------------
CHARACTER*2 LABEL
INTEGER NX, NY, N, IX, JY, LW, PGOPEN
REAL X, X1, X2, XOFF, Y, Y1, Y2, YOFF, DX, DY
REAL XPIX1, XPIX2, YPIX1, YPIX2, RES
C
C Call PGOPEN to initiate PGPLOT and open the output device; PGOPEN
C will prompt the user to supply the device name and type. Always
C check the return code from PGOPEN.
C
IF (PGOPEN('?') .LE. 0) STOP
C
C Determine size of view surface.
C Lower left corner is (X1,Y1), upper right (X2, Y2) [inches].
C
CALL PGPAGE
CALL PGSVP(0.0, 1.0, 0.0, 1.0)
CALL PGQVP(1, X1, X2, Y1, Y2)
X = X2-X1
Y = Y2-Y1
C
C Determine device resolution (pixels/inch), and use it to choose
C line width.
C
CALL PGQVP(3, XPIX1, XPIX2, YPIX1, YPIX2)
RES = ABS(XPIX2-XPIX1)/ABS(X)
LW = 1
IF (RES.GT.166.0) LW = 2
C
C Choose horizontal or vertical arrangement depending on
C device aspect ratio.
C
IF (X.GT.Y) THEN
NX = 8
NY = 5
ELSE
NX = 5
NY = 8
END IF
DX = MIN(X/NX, 0.95*Y/NY)
DY = DX
IX = NX
JY = 1
XOFF = X1 + (X-NX*DX)*0.5
YOFF = Y1 + (0.95*Y-NY*DY)*0.5
CALL PGBBUF
C
C Each symbol will be drawn in a standard window; the window is moved
C by manipulating the viewport.
C
CALL PGSWIN(-1.,1.,-1.,1.)
C
C Loop through all known symbols (N=0-31 and -1 to -8).
C
DO 10 N=0,39
IF (N.LE.31) WRITE (LABEL,'(I2)') N
IF (N.GT.31) WRITE (LABEL,'(I2)') 31-N
C
C Define window and viewport. The loop allows the plot to extend over
C more than one page if necessary; each page is labelled at the top.
C
IX = IX+1
IF (IX.GT.NX) THEN
IX = 1
JY = JY-1
END IF
IF (JY.LT.1) THEN
JY = NY
IF (N.NE.0) CALL PGPAGE
CALL PGSCH(1.2)
CALL PGVSIZ(XOFF, XOFF+NX*DX, YOFF, YOFF+NY*DY)
CALL PGSLW(LW)
CALL PGMTXT('T', 1.0, 0.5, 0.5,
1 '\fiPGPLOT \frMarker Symbols')
END IF
CALL PGVSIZ(XOFF+(IX-1)*DX, XOFF+IX*DX,
1 YOFF+(JY-1)*DY, YOFF+JY*DY)
C
C Call PGBOX to draw a box and PGMTXT to label it.
C
CALL PGSLW(1)
CALL PGBOX('BC',10.0,0,'BC',10.0,0)
CALL PGSCH(0.5)
CALL PGMTXT('T',-1.5,0.05,0.0,LABEL)
C
C Call PGPT1 to draw the symbol.
C
CALL PGSLW(LW)
CALL PGSCH(1.5)
IF (N.LE.31) CALL PGPT1(0.0,0.0,N)
IF (N.GT.31) CALL PGPT1(0.0,0.0,31-N)
10 CONTINUE
C
CALL PGEBUF
C
C Finally, call PGCLOS to terminate things properly.
C
CALL PGCLOS
C
END