
      PROGRAM AGEX06
C
C Define the error file, the Fortran unit number, the workstation type,
C and the workstation ID to be used in calls to GKS routines.
C
C     PARAMETER (IERRF=6, LUNIT=2, IWTYPE=1,  IWKID=1)   ! NCGM
      PARAMETER (IERRF=6, LUNIT=2, IWTYPE=8,  IWKID=1)   ! X Windows
C     PARAMETER (IERRF=6, LUNIT=2, IWTYPE=11, IWKID=1)   ! PDF
C     PARAMETER (IERRF=6, LUNIT=2, IWTYPE=20, IWKID=1)   ! PostScript
C
C
C Define the data arrays.
C
      REAL XDRA(501),YDRA(501)
C
C Define the graph-window parameter array.
C
      REAL GWND (4)
C
C Define variables used in setting up informational labels.
C
      CHARACTER*35 GLAB
      CHARACTER*23 BACK
      CHARACTER*12 LNLG
C
      DATA (GWND(I),I=1,4) / 0.2 , 0.5 , 0.0 , 0.9 /
      DATA BACK / '(PERIMETER BACKGROUND)$' /
C
      DATA LNLG / 'LOGARITHMIC$' /
C
C Initialize GKS.
C
      CALL GOPKS (IERRF, ISZDM)
      CALL GOPWK (IWKID, LUNIT, IWTYPE)
      CALL GACWK (IWKID)
C
C Fill the data arrays.
C
      DO 101 I=1,501
        THETA=.031415926535898*REAL(I-1)
        XDRA(I)=500.+.9*REAL(I-1)*COS(THETA)
        YDRA(I)=500.+.9*REAL(I-1)*SIN(THETA)
  101 CONTINUE
C
C Suppress the frame advance.
C
      CALL AGSETI ('FRAME.',2)
C
C Position the graph window.
C
      CALL AGSETP ('GRAPH WINDOW.',GWND,4)
      CALL AGSETI ('BACKGROUND TYPE.',4)
C
C Setting the background type may have turned informational
C labels off.  In that case, turn them back on.
C
      CALL AGSETI ('LABEL/CONTROL.',2)
C     
C Declare the linear/log nature of the graph.
C
      CALL AGSETI ('X/LOGARITHMIC.',1)
      CALL AGSETI ('Y/LOGARITHMIC.',1)
C
C Change the x- and y-axis labels to reflect the linear/log
C nature of the graph.
C
      CALL AGSETC ('LABEL/NAME.','B')
      CALL AGSETI ('LINE/NUMBER.',-100)
      CALL AGSETC ('LINE/TEXT.',LNLG)

      CALL AGSETC ('LABEL/NAME.','L')
      CALL AGSETI ('LINE/NUMBER.',100)
      CALL AGSETC ('LINE/TEXT.',LNLG)
C
C Set up the label for the top of the graph.
C
      WRITE (GLAB,1001) BACK
C
C Draw the graph, using EZXY.
C
      CALL EZXY (XDRA,YDRA,501,GLAB)
C
C Draw a boundary around the edge of the plotter frame.
C
      CALL BNDARY
C
C Advance the frame.
C
      CALL FRAME
C
C Close GKS.
C
      CALL GDAWK (IWKID)
      CALL GCLWK (IWKID)
      CALL GCLKS
C
      STOP
C
C Format for encode.
C
 1001 FORMAT ('EXAMPLE ',' ',A23)
      END
      SUBROUTINE BNDARY
C
C Routine to draw the plotter-frame edge.
C
      CALL PLOTIT (    0,    0,0)
      CALL PLOTIT (32767,    0,1)
      CALL PLOTIT (32767,32767,1)
      CALL PLOTIT (    0,32767,1)
      CALL PLOTIT (    0,    0,1)
      RETURN
      END

