%N pghist %F $MIR/src/pghist.f
%D Histogram of unbinned data
%B
      SUBROUTINE PGHIST(N, DATA, DATMIN, DATMAX, NBIN, PGFLAG)
      INTEGER N
      REAL    DATA(*)
      REAL    DATMIN, DATMAX
      INTEGER NBIN, PGFLAG

 Draw a histogram of N values of a variable in array
 DATA(1...N) in the range DATMIN to DATMAX using NBIN bins.  Note
 that array elements which fall exactly on the boundary between
 two bins will be counted in the higher bin rather than the
 lower one; and array elements whose value is less than DATMIN or
 greater than or equal to DATMAX will not be counted at all.

 Arguments:
  N      (input)  : the number of data values.
  DATA   (input)  : the data values. Note: the dimension of array
                    DATA must be greater than or equal to N. The
                    first N elements of the array are used.
  DATMIN (input)  : the minimum data value for the histogram.
  DATMAX (input)  : the maximum data value for the histogram.
  NBIN   (input)  : the number of bins to use: the range DATMIN to
                    DATMAX is divided into NBIN equal bins and
                    the number of DATA values in each bin is
                    determined by PGHIST.  NBIN may not exceed 200.
  PGFLAG (input)  : if PGFLAG = 1, the histogram is plotted in the
                    current window and viewport; if PGFLAG = 0,
                    PGENV is called automatically by PGHIST to start
                    a new plot (the x-limits of the window will be
                    DATMIN and DATMAX; the y-limits will be chosen
                    automatically.
                    IF PGFLAG = 2,3 the histogram will be in the same
                    window and viewport but with a filled area style.
                    If pgflag=4,5 as for pgflag = 0,1, but simple
                    line drawn as for PGBIN
