ソースコードの所在: /home/kizu/pgplot/samples/pgex21.f

(このプログラムで描ける絵は、こちら)


      PROGRAM PGEX21
C-----------------------------------------------------------------------
C Test subroutine for PGPLOT: screen alignment and color palette.
C-----------------------------------------------------------------------
      INTEGER I, L1, L2, PGOPEN
      REAL X1, X2, Y1, Y2
      CHARACTER*80 GTYPE, GVER
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 Get PGPLOT information.
C
      CALL PGQINF('VERSION', GVER, L1)
      CALL PGQINF('TYPE', GTYPE, L2)
      CALL PGBBUF
C
C Alignment test: clear the screen, and draw a box and grid using
C three monochrome intensities (color indices 1, 14, and 15).  The
C plot uses the largest available square viewport and and unit window.
C
      CALL PGPAGE
      CALL PGSVP(0.0,1.0,0.0,1.0)
      CALL PGWNAD(0.0,1.0,0.0,1.0)
      CALL PGSCI(14)
      CALL PGBOX('g',0.02,1,'g',0.02,1)
      CALL PGSCI(15)
      CALL PGBOX('g',0.1,5,'g',0.1,5)
      CALL PGSCI(1)
      CALL PGBOX('bc',0.1,5,'bc',0.1,5)
C
C Color palette test.
C
      DO 20 I=0,15
          CALL PGSCI(I)
          X1 = 0.31 + MOD(I,4)*0.1
          Y1 = 0.61 - (I/4)*0.1
          X2 = X1 + 0.08
          Y2 = Y1 + 0.08
          CALL PGRECT(X1, X2, Y1, Y2)
   20 CONTINUE
C
C Write the device type on the plot.
C
      CALL PGSCI(0)
      CALL PGRECT(0.31, 1.0-0.31, 0.85, 0.97)
      CALL PGSCI(1)
      CALL PGSFS(2)
      CALL PGRECT(0.31, 1.0-0.31, 0.85, 0.97)
      CALL PGPTXT(0.5, 0.91, 0.0, 0.5, 'PGPLOT '//GVER(1:L1))
      CALL PGPTXT(0.5, 0.87, 0.0, 0.5, 'Device '//GTYPE(1:L2))
C
      CALL PGEBUF
C
C Finally, call PGCLOS to terminate things properly.
C
      CALL PGCLOS
C
      END