! Example from PGPLOT documentation
! comments added by Jim Crumley  1/30/2007
! To compile this, the PGPlot library needs to be included:
!   gfortran -lpgplot simple_pgplot.f -o simple_pgplot
! or:
!  gfortran -L /usr/lib/ -lpgplot simple_pgplot.f -o simple_pgplot
! where you replace /usr/lib/ with the path to libpgplot.so on
! your system.


      PROGRAM SIMPLE_PGPLOT
      INTEGER I, IER, PGBEG
      REAL XR(100), YR(100)
      REAL XS(5), YS(5)
      DATA XS/1.,2.,3.,4.,5./
      DATA YS/1.,4.,9.,16.,25./

      !open up the graphics device (0, device, NX, NY)
      ! first number always 0, second specifies a device - '?' asks
      ! at run time.  
      ! NX and NY are used to break a plot into sub plots - 
      ! NX and NY specify how many
      IER = PGBEG(0,'?',1,1)
      IF (IER.NE.1) STOP

      !sets up scale on plots(xmin, xmax, ymin, ymax,scales_equal?,grid_features)
      CALL PGENV(0.,10.,0.,20.,0,1)

      !set x and y axis labels and title in that order
      CALL PGLAB('(x)', '(y)', 'A Simple Graph') 

      !Plot pts fro data (num_points, x_data, y_data, point_symbol)
      CALL PGPT(5,XS,YS,9)
      DO 10 I=1,60
          XR(I) = 0.1*I
          YR(I) = XR(I)**2
   10 CONTINUE
      
      ! Draw the line for the theoretical  (num_points, x_data, y_data)
      CALL PGLINE(60,XR,YR)

      !close the plot
      CALL PGEND
      END
