HHSTP

Prints a horizontal histogram.

Required Arguments

FRQ —Vector of length NBAR containing the frequencies or counts. (Input)
Elements of FRQ must be nonnegative.

IBEG — Indicates the beginning setting of the plot. (Input)
If IBEG = 0, HHSTP skips to a new page before printing the first line. If IBEG  0, HHSTP skips two spaces and begins printing on the same page.

TITLECHARACTER string containing the title of the histogram. (Input)

Optional Arguments

NBAR — Number of bars. (Input)
NBAR must be positive.
Default: NBAR = size (FRQ,1).

ISPACE — Indicates spaces between horizontal histogram lines. (Input)
ISPACE = 0, 1, or 2 is allowed.
Default: ISPACE = 1.

LENGTH — Indicates the upper limit of the number of lines to print within the histogram per page. (Input)
After that number of lines is printed, the routine skips to a new page to continue printing. If LENGTH = 0; then the maximum number of lines coincides with the standard printer page, which is 60.
Default: LENGTH = 0.

IREP — Determines the repeating appearance for the class line (top) and frequency line (bottom) when multiple pages are required. (Input)
If IREP = 0, the class line and the frequency line are printed on the first and last page of the histogram, respectively. If IREP  0, both class and frequency line are printed on every page.
Default: IREP = 0.

IOPT — Page width option. (Input)
IOPT = 0 will cause a full (horizontal) page histogram. IOPT = 1 will limit the width to 80 columns.
Default: IOPT = 1.

FORTRAN 90 Interface

Generic: CALL HHSTP (FRQ, IBEG, TITLE [])

Specific: The specific interface names are S_HHSTP and D_HHSTP.

FORTRAN 77 Interface

Single: CALL HHSTP (NBAR, FRQ, IBEG, ISPACE, LENGTH, IREP, IOPT, TITLE)

Double: The double precision name is DHHSTP.

Description

The routine HHSTP prints a horizontal histogram on one or more pages. Given a vector containing frequencies or counts, HHSTP determines the maximum count Tmax. Horizontal printing position depends on K defined by

K = 1 + (Tmax – 1)/60 for 72 characters

K = 1 + (Tmax – 1)/120 for 132 characters

If a frequency is greater than K, then a character is printed in the first position. Henceforth, K is increased by K/60 or K/120 for each position, and frequencies are compared to the resulting K.

Comments

Informational Errors

 

Type

Code

Description

3

3

ISPACE is not 0, 1, or 2. The zero option is used for ISPACE.

3

6

IOPT is not 0 or 1. The zero option is used for IOPT.

3

7

TITLE is too long and is truncated from the right side.

Example

Consider the data set in Example 1of the routine OWFRQ (see Chapter 1, "Basic Statistics"). We use the routine OWFRQ to create a one‑way frequency table. A horizontal histogram is then generated using HHSTP. The user may find a vertical histogram for the same data set in the routine. Note that classes are listed from left to right in VHSTP.

 

USE UMACH_INT

USE OWFRQ_INT

USE HHSTP_INT

 

IMPLICIT NONE

INTEGER NBAR, NOBS

PARAMETER (NBAR=10, NOBS=30)

!

INTEGER IBEG, IOPT, NOUT

REAL CLHW, DIV(NBAR), TABLE(NBAR), X(NOBS), XHI, XLO

!

DATA X/0.77, 1.74, 0.81, 1.20, 1.95, 1.20, 0.47, 1.43, 3.37, &

2.20, 3.00, 3.09, 1.51, 2.10, 0.52, 1.62, 1.31, 0.32, 0.59, &

0.81, 2.81, 1.87, 1.18, 1.35, 4.75, 2.48, 0.96, 1.89, 0.90, &

2.05/

! Get output unit number

CALL UMACH (2, NOUT)

! Create a one-way frequency table from

! a given data set with intervals of

! equal length and user-supplied values

! of XLO and XHI

IOPT = 1

XLO = 0.5

XHI = 4.5

CALL OWFRQ (X, NBAR, TABLE, IOPT=IOPT, XLO=XLO, XHI=XHI, DIV=DIV)

WRITE (NOUT,99999) DIV, TABLE

99999 FORMAT (' Midpoints: ', 10F6.2, /, ' Counts: ', 10F6.0)

! Create the horizontal histogram

IBEG = 1

IOPT = 0

CALL HHSTP (TABLE, IBEG, 'Histogram', IOPT=IOPT)

END

Output

 

Midpoints: .25 .75 1.25 1.75 2.25 2.75 3.25 3.75 4.25 4.75

Counts: 2. 7. 6. 6. 4. 2. 2. 0. 0. 1.

 

Histogram

Class -----------

10 *I *

* *

9 * *

* *

8 * *

* *

7 *II *

* *

6 *II *

* *

5 *IIII *

* *

4 *IIIIII *

* *

3 *IIIIII *

* *

2 *IIIIIII *

* *

1 *II *

-----------------

Frequency 5

One frequency unit is equal to 1 count unit(s).