VHSTP

Prints a vertical histogram.

Required Arguments

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

TITLECHARACTER string containing main title. (Input)

Optional Arguments

NBAR – Number of bars. (Input)
If NBAR exceeds 100/(ISP + 1), then NBAR = 100/(ISP + 1) is used. NBAR must be positive.
Default: NBAR = size (FRQ,1).

ISP — Spacing between histogram bars. (Input)
ISP may be 0, 1, or 4.
Default: ISP= 4.

FORTRAN 90 Interface

Generic: CALL VHSTP (FRQ, TITLE [])

Specific: The specific interface names are S_VHSTP and D_VHSTP.

FORTRAN 77 Interface

Single: CALL VHSTP (NBAR, FRQ, ISP, TITLE)

Double: The double precision name is DVHSTP.

Description

VHSTP prints a vertical histogram on not more than one printer page using not more than 50 vertical and 100 horizontal print positions. Spacing control is allowed on the horizontal axis.

Given a vector containing positive counts, VHSTP determines the maximum count Tmax. Vertical printing position depends on K defined by K = 1 + (Tmax – 1)/50. If a frequency is greater than K, then a character is printed on the corresponding position of the first horizontal line from above. Henceforth, K is reduced by K/50 for each horizontal line, and frequencies are compared to the new K.

Comments

1. Informational errors

 

Type

Code

Description

3

1

ISP is out of range. ISP = 0 is used.

3

3

NBAR * (ISP + 1) is less than 1 or greater than 100. The width of the histogram is set to 100, and 100/(ISP + 1) bars are printed. The number of class intervals will be printed completely if ISP  0 and will always be printed up to and including 100/(ISP + 1) even though the histogram body is only 100 spaces wide.

3

5

The maximum value in the vector FRQ is less than 1; therefore, the body of the histogram is blank.

3

6

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

2. Output is written to the unit specified by the routine UMACH (see the Reference Material section of this manual;).

3. TITLE is centered and placed at the top of the plot. The plot starts on a new page.

Example

Consider the data set in Example 1of the routine OWFRQ (see Chapter 1, "Basic Statistics".) This data set consists of the measurements (in inches) of precipitaion in Minneapolis/St. Paul during the month of March for 30 consecutive years. We use the routine OWFRQ to create a one‑way frequency table. A vertical histogram is then generated using VHSTP. A horizontal histogram for the same data set can be found in the document example for the routine .

 

USE UMACH_INT

USE OWFRQ_INT

USE VHSTP_INT

 

IMPLICIT NONE

INTEGER NBAR, NOBS

PARAMETER (NBAR=10, NOBS=30)

!

INTEGER IOPT, NOUT

REAL 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 using 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

CALL VHSTP (TABLE, 'Plot of VHSTP')

END

Output

 

Midpoints: 0.25 0.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.

 

Plot of VHSTP

Frequency-------------------------------------------------------

7 * I *

6 * I I I *

5 * I I I *

4 * I I I I *

3 * I I I I *

2 * I I I I I I I *

1 * I I I I I I I I *

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

Class 1 2 3 4 5 6 7 8 9 10