%N pgbox %F $MIR/src/pgbox.f
%D Draw labeled frame around viewport
%B
      SUBROUTINE PGBOX (XOPT, XTICK, NXSUB, YOPT, YTICK, NYSUB)
      CHARACTER*(*) XOPT, YOPT
      REAL XTICK, YTICK
      INTEGER NXSUB, NYSUB

 Annotate the viewport with frame, axes, numeric labels, etc.
 PGBOX is called by on the user's behalf by PGENV, but may also be
 called explicitly.

 Arguments:
  XOPT   (input)  : string of options for X (horizontal) axis of
                    plot. Options are single letters, and may be in
                    any order (see below).
  XTICK  (input)  : world coordinate interval between major tick marks
                    on X axis. If XTICK=0.0, the interval is chosen by
                    PGBOX, so that there will be at least 3 major tick
                    marks along the axis.
  NXSUB  (input)  : the number of subintervals to divide the major
                    coordinate interval into. If XTICK=0.0 or NXSUB=0,
                    the number is chosen by PGBOX.
  YOPT   (input)  : string of options for Y (vertical) axis of plot.
                    Coding is the same as for XOPT.
  YTICK  (input)  : like XTICK for the Y axis.
  NYSUB  (input)  : like NXSUB for the Y axis.

 Options (for parameters XOPT and YOPT):
  A : draw Axis (X axis is horizontal line Y=0, Y axis is vertical
      line X=0).
  B : draw bottom (X) or left (Y) edge of frame.
  C : draw top (X) or right (Y) edge of frame.
  G : draw Grid of vertical (X) or horizontal (Y) lines.
  I : Invert the tick marks; ie draw them outside the viewport
      instead of inside.
  L : label axis Logarithmically (see below).
  N : write Numeric labels in the conventional location below the
      viewport (X) or to the left of the viewport (Y).
  P : extend ("Project") major tick marks outside the box (ignored if
      option I is specified).
  M : write numeric labels in the unconventional location above the
      viewport (X) or to the right of the viewport (Y).
  T : draw major Tick marks at the major coordinate interval.
  S : draw minor tick marks (Subticks).
  V : orient numeric labels Vertically. This is only applicable to Y.
      The default is to write Y-labels parallel to the axis.
  1 : force decimal labelling, instead of automatic choice (see PGNUMB).
  2 : force exponential labelling, instead of automatic.

 To get a complete frame, specify BC in both XOPT and YOPT.
 Tick marks, if requested, are drawn on the axes or frame
 or both, depending which are requested. If none of ABC is specified,
 tick marks will not be drawn. When PGENV calls PGBOX, it sets both
 XOPT and YOPT according to the value of its parameter AXIS:
 -1: 'BC', 0: 'BCNST', 1: 'ABCNST', 2: 'ABCGNST'.

 For a logarithmic axis, the major tick interval is always 1.0. The
 numeric label is 10**(x) where x is the world coordinate at the
 tick mark. If subticks are requested, 8 subticks are drawn between
 each major tick at equal logarithmic intervals.

 To label an axis with time (days, hours, minutes, seconds) or
 angle (degrees, arcmin, arcsec), use routine PGTBOX.
