Drawing a histogram

                       +--------------------------+
                       |CALL  IGHIST (N,X,Y,CHOPT) |
                       +--------------------------+
                                  
Action: This routine draws a one-dimensional histogram with several possible presentations chosen by the user (histograms, bars, columns, smoothed graphs, etc.). Parameter Description:
N
Number of bins in X and/or Y.
X
Is either an array of dimension N containing x coordinates or a two-dimensional array with (XMIN,XMAX) (world coordinates space).
Y
Is either an array of dimension N containing y coordinates or a two-dimensional array with (YMIN,YMAX) (world coordinates space).
CHOPT
CHARACTER variable specifying the options selected (Multiple simultaneous options are possible). Note that the number of components needed in the array X and/or Y may depend on the value of CHOPT.
'R'
The histogram is Rotated, i.e. the values in X are used for the ordinate and the values in Y for the abscissa (default is the contrary). If option 'R' is selected (and option 'N' is not selected), the user must give:
  1. 2 values for Y (Y(1)=YMIN and Y(2)=YMAX)
  2. N values for X, one for each bin. Otherwise the user must give:
    1. N values for Y, one for each bin.
    2. 2 values for X (X(1)=XMIN and X(2)=XMAX) For option 'N' see below.
      'N'
      Non equidistant bins (default is equidistant). The arrays X and Y must be dimensioned as follows: If option R is not selected (default) then the user must give:
      1. (N+1) values for X (the limits of the bins).
      2. N values for Y, one for each bin. Otherwise the user must give:
        1. (N+1) values for Y (the limits of the bins).
        2. N values for X, one for each bin.
          'H'
          An histogram is drawn as a contour (default).
          'F'
          The area delimited by the histogram is filled according to the fill area interior style and the fill area style index or colour index. The contour is not drawn unless the 'H' option is also selected.
          'C'
          A smooth curve is drawn across the points at the center of each bin of the histogram.
          'L'
          A straight line is drawn across the points at the center of each bin of the histogram.
          '*'
          A star is plotted at the center of each bin of the histogram.
          'P'
          The current polymarker is plotted at the center of each bin of the histogram.
          'B'
          A bar chart with equidistant bins is drawn as fill areas (contours are drawn). The bar origin and the bar width can be controlled by routine IGSET and the BARO and BARW options.
          'A'
          The x and y axes are drawn.
          'GX'
          Logarithmic scale on the X axis.
          'GY'
          Logarithmic scale on the Y axis.
       Example of HISTOGRAM drawing (see result on figure
                           [more info])
                                  
      program hist
      dimension x(2),y(10)
      parameter (xsize=16.,ysize=20.)
      data y/10.,30.,50.,400.,700.,900.,110.,90.,100.,40./
      data x/1.,1000./
*
      call start('hist',xsize,ysize)
*
*              Viewports definition
*
      xnorm  = min(1.,xsize/ysize)
      xnorm2 = xnorm/2.
      ynorm  = min(1.,ysize/xsize)
      ynorm2 = ynorm/2.
      rmarg  = 0.05
      rmarg2 = rmarg/2.
      call isvp(10,rmarg,xnorm2-rmarg2,ynorm2+rmarg2,ynorm-rmarg)
      call isvp(20,xnorm2+rmarg2,xnorm-rmarg,ynorm2+rmarg2,ynorm-rmarg)
      call isvp(30,rmarg,xnorm2-rmarg2,rmarg,ynorm2-rmarg2)
      call isvp(40,xnorm2+rmarg2,xnorm-rmarg,rmarg,ynorm2-rmarg2)
*
*              Some attributes setting
*
      call isclip(0)
      call igset('FASI',244.)
      call igset('FAIS',3.)
      call igset('CHHE',50.)
*
*              HISTOGRAM drawing
*
      call iswn(10,1.,1000.,1.,1000.)
      call iselnt(10)
      call ighist(10,x,y,'AHC*')
*
      call iswn(20,1.,1000.,1.,1000.)
      call iselnt(20)
      call ighist(10,x,y,'AB')
*
      call iswn(30,1.,1000.,log10(1.),log10(1000.))
      call iselnt(30)
      call ighist(10,x,y,'AHFGY')
*
      call iswn(40,log10(1.),log10(1000.),1.,1000.)
      call iselnt(40)
      call ighist(10,x,y,'AHFGX')
*
      call finish
      end

                                                                                       

< A>

Figure: Examples of IGHIST usage.

[HIST]