Previous chapter LLUs Home Next chapter IndexHistograms (bar charts) are used to show the distribution of values in a like-sample dataset. The individual values are sorted by size into a number of value ranges called "class intervals." The number of samples out of the total that fall into a class interval are represented as a histogram bar height. The height of each histogram bar is proportional to the number of samples in that class interval.
For a complete description of the Histogram parameters, see the histogram_params man page.
------------------------------------------------------------------------------------------------ Parameter Fortran type Set by Brief description Default value ------------------------------------------------------------------------------------------------ FOR Character HSTOPC FORmat for class labels '(G10.3)' TIT Character HSTOPC A main TITle No title LAB Character HSTOPC Class interval axis LABel 'CLASS INTERVALS' ('MID=OFF') 'CLASS MIDVALUES' ('MID=ON') FQN Character HSTOPC FreQueNcy axis label 'FREQUENCY' CHR Character HSTOPC Class interval label string Internal numeric labels COL Integer HSTOPI 8 COLorable graphic components All are white on black CLA Integer HSTOPI Size of CLAss labels Medium size characters Orientation of class labels Horizontal labels HOR Logical HSTOPL Direction of histogram bars Vertical PER Logical HSTOPL A PERcentage axis opposite the The axis is drawn frequency axis MID Logical HSTOPL Location of class interval labels Placed at interval midpoints SHA Logical HSTOPL SHAding of histogram bars Bars are shaded DRL Logical HSTOPL Grid lines through bars No lines are drawn MED Logical HSTOPL A line drawn at data MEDian No line is drawn PRM Logical HSTOPL A PeRiMeter around the histogram No perimeter is drawn FRA Logical HSTOPL Advance the FRAme The frame is advanced LIS Logical HSTOPL LISt parameter values on output No printed list DEF Logical HSTOPL Reset all parameters to DEFaults WIN Real HSTOPR Region of frame to put histogram The entire frame SPA Real HSTOPR SPAcing between histogram bars Spacing = 2.0 Dual histogram overlap Overlap = -1.0 ------------------------------------------------------------------------------------------------
1 CALL HSTOPL('DEF=ON') 2 CALL HISTGR(DAT1, NDIM, NPTS, IFLAG, CLASS, NCLASS, WORK, NWRK)
CALL HISTGR (DAT1, NDIM, NPTS, IFLAG, CLASS, NCLASS, WORK, NWRK)
NCLASS = 5
CLASS(1) = 0.
CLASS(2) = 2.
CLASS(3) = 4.
CLASS(4) = 6.
CLASS(5) = 8.
CLASS(6) = 10.
NPTS = 5
CLASS(1) = 1.
CLASS(2) = 3.
CLASS(3) = 5.
CLASS(4) = 7.
CLASS(5) = 9.
NDIM + 3 * (NCLASS + 1)
1 IFLAG = 3 2 NCLASS = 6 3 NPTS2 = 2 4 CALL HSTOPL('DEF=ON') 5 CALL HSTOPI('COL=ON',3,0,COLORS,8) 6 CALL HSTOPC('TIT=ON', + 'OPTIONS CHANGED: PRM,TIT,CHA,LAB,FOR,COL,FQN and SPA',7,3) 7 CALL HSTOPL('PRM=ON') 8 CALL HSTOPC('FQN=ON','MONTHLY PRECIPITATION',7,3) 9 CALL HSTOPC('FOR=ON','(F3.0)',9,3) 10 MON='JANFEBMARAPRMAYJUNJULAUGSEPOCTNOVDEC' 11 CALL HSTOPC('CHR=ON',MON,12,3) 12 CALL HSTOPC('LAB=ON','COMPARE TWO DATASETS',7,3) 13 SPAC(1) = 2.0 14 SPAC(2) = -1.5 15 CALL HSTOPR('SPA=ON',SPAC,2) 16 CALL HISTGR(DAT1, NDIM, NPTS2, IFLAG, CLASS, NCLASS, WORK, NWRK)
Line 4 resets all internal parameters to their default values.
Line 5 assigns colors to the eight components of the graphic. (Specific colors are not shown since this document is not produced in color.)
Line 6 creates a main title that shows which parameters were reset for this plot.
Line 7 requests a perimeter (box) be drawn around the histogram.
Line 8 sets the frequency axis title.
Line 9 assigns an F3.0 format to class labels.
Line 10 concatenates a string of twelve 3-character alphanumeric labels representing the months of a year.
Line 11 assigns these labels to the classes (histogram bars).
Line 12 sets a class title.
Lines 13 defines the amount of histogram bar spacing, and line 14 defines the amount by which the two histograms are to overlap. Line 15 sets the two spacing parameters.
Line 16 generates the histogram.
1 IFLAG = 0 2 NCLASS = 17 3 NPTS = 320 4 CALL HSTOPL('DEF=ON') 5 CALL HSTOPC('TIT=ON', + 'OPTS CHANGED: HOR, WIN, FRA, MED, COL, SPA, and TIT',9,3) 6 CALL HSTOPL('HOR=ON') 7 CALL HSTOPL('MED=ON') 8 ARR7(1) = 0. 9 ARR7(2) = .5 10 ARR7(3) = .5 11 ARR7(4) = 1. 12 CALL HSTOPR('WIN=ON',ARR7,4) 13 CALL HSTOPI('COL=ON',2,0,COLORS,8) 14 SPAC(1) = 3.0 15 SPAC(2) = 0.0 16 CALL HSTOPR('SPA=ON',SPAC,2) 17 CALL HSTOPL('FRA=OFF') 18 CALL HISTGR(DAT1, NDIM, NPTS, IFLAG, CLASS, NCLASS, WORK, NWRK)
Line 3 defines the size of the DAT1 array at 320 data values.
Line 4 resets all internal parameters to their default values.
Line 5 assigns a main title that relates which internal parameters are set for this histogram.
Line 6 requests that the histogram bars be drawn horizontally.
Line 7 requests a median line be drawn through the histogram.
Lines 8 through 12 set the location where this histogram will be drawn on a plotter frame that has a range of 0. to 1. in both dimensions. This particular call will place this histogram in the upper left quadrant.
Note: The process for putting multiple histograms on a page was to use the parameter WIN instead of using four calls to the SET routine of SPPS. This is because window and viewport scaling are done within the HISTGR routine, which would override any SET call put in the user code.
Line 13 sets colors for the graphics (not shown in the output here).
Lines 14 through 16 set the spacing between histogram bars.
Line 17 turns off the frame advance so that additional histograms can be drawn on the frame.
Line 18 generates the histogram shown in the upper left quadrant of the graphic.
Caveat: We regret the name choice of the parameter "WIN." In the terminology of GKS, this parameter should be called the viewport, not the window, since the viewport defines the plotting area on the output device.
Previous chapter LLUs Home Next chapter Index