%N pgenv %F $MIR/src/pgenv.f
%D Set window and viewport and draw labeled frame
%B
      SUBROUTINE PGENV (XMIN, XMAX, YMIN, YMAX, JUST, AXIS)
      REAL XMIN, XMAX, YMIN, YMAX
      INTEGER JUST, AXIS

 Set PGPLOT "Plotter Environment".  PGENV establishes the scaling
 for subsequent calls to PGPT, PGLINE, etc.  The plotter is
 advanced to a new page or panel, clearing the screen if necessary.
 If the "prompt state" is ON (see PGASK), confirmation
 is requested from the user before clearing the screen.
 If requested, a box, axes, labels, etc. are drawn according to
 the setting of argument AXIS.

 Arguments:
  XMIN   (input)  : the world x-coordinate at the bottom left corner
                    of the viewport.
  XMAX   (input)  : the world x-coordinate at the top right corner
                    of the viewport (note XMAX may be less than XMIN).
  YMIN   (input)  : the world y-coordinate at the bottom left corner
                    of the viewport.
  YMAX   (input)  : the world y-coordinate at the top right corner
                    of the viewport (note YMAX may be less than YMIN).
  JUST   (input)  : if JUST=1, the scales of the x and y axes (in
                    world coordinates per inch) will be equal,
                    otherwise they will be scaled independently.
  AXIS   (input)  : controls the plotting of axes, tick marks, etc:
      AXIS = -2 : draw no box, axes or labels;
      AXIS = -1 : draw box only;
      AXIS =  0 : draw box and label it with coordinates;
      AXIS =  1 : same as AXIS=0, but also draw the
                  coordinate axes (X=0, Y=0);
      AXIS =  2 : same as AXIS=1, but also draw grid lines
                  at major increments of the coordinates;
      AXIS = 10 : draw box and label X-axis logarithmically;
      AXIS = 20 : draw box and label Y-axis logarithmically;
      AXIS = 30 : draw box and label both axes logarithmically.

 For other axis options, use routine PGBOX. PGENV can be persuaded to
 call PGBOX with additional axis options by defining an environment
 parameter PGPLOT_ENVOPT containing the required option codes. 
 Examples:
   PGPLOT_ENVOPT=P      ! draw Projecting tick marks
   PGPLOT_ENVOPT=I      ! Invert the tick marks
   PGPLOT_ENVOPT=IV     ! Invert tick marks and label y Vertically
