VHS2P

Prints a vertical histogram with every bar subdivided into two parts.

Required Arguments

FRQX — Vector of length NBAR. (Input)
FRQX contains the frequencies or counts, and the elements of FRQX must be nonnegative.

FRQY — Vector of length NBAR. (Input)
FRQY contains the second frequencies or counts, and the elements of FRQY must be nonnegative.

TITLECHARACTER string containing the title. (Input)

Optional Arguments

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

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

FORTRAN 90 Interface

Generic: CALL VHS2P (FRQX, FRQY, TITLE [])

Specific: The specific interface names are S_VHS2P and D_VHS2P.

FORTRAN 77 Interface

Single: CALL VHS2P (FRQX, FRQY, TITLE, NBAR, ISP)

Double: The double precision name is DVHS2P.

Description

The routine VHS2P prints a vertical histogram on one or more pages, using not more than 50 vertical and 100 horizontal print positions. Spacing control is allowed on the horizontal axis. Given two vectors containing positive counts, VHS2P determines the maximum count of the combined vectors 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 first line. Henceforth, K is reduced by K/50 for each position, and frequencies are compared to the new K.

Comments

1. Workspace may be explicitly provided, if desired, by use of V2S2P/DV2S2P. The reference is:

CALL V2S2P (NBAR, FRQX, FRQY, ISP, TITLE, WK)

The additional argument is

WK — Work vector of length 2 * NBAR.

2. Informational errors

 

Type

Code

Description

3

2

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.

3

3

ISP as specified is not valid. The zero option is used.

3

4

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

3. If NBAR exceeds 100/(ISP + 1), then only 100/(ISP + 1) bars are printed.

4. If the maximum frequency is greater than 9999, the frequency column contains on some lines.

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

6. TITLE is automatically centered and plot starts on a new page.

Example

Let X = FRQX contain 12 months of projected income figures and let Y = FRQY contain the actual income figures for the same 12 months. VHS2P produces a histogram that allows projected versus actual figures to be graphically compared.

 

USE VHS2P_INT

USE UMACH_INT

 

IMPLICIT NONE

INTEGER NBAR

PARAMETER (NBAR=12)

!

INTEGER ISP, NOUT

REAL FRQX(NBAR), FRQY(NBAR)

!

DATA FRQX/11., 4., 4., 8., 4., 3., 10., 14., 4., 20., 4., 3./

DATA FRQY/10., 6., 4., 12., 3., 4., 8., 18., 6., 18., 3., 7./

!

CALL VHS2P (FRQX, FRQY, 'Plot of VHS2P')

! Get output unit number

CALL UMACH (2, NOUT)

WRITE (NOUT,99999)

99999 FORMAT (/, 3X, 'Twelve months projected sales versus actual ', &

'sales, in thousands of dollars.', /, 11X, 'A positive ', &

'sign (+) implies projected exceeded actual.', /, 11X, &

'A negative sign (-) implies actual exceeded projected.')

!

END

Output

 

Plot of VHS2P

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

20 -

19 -

18 + I

17 + I

16 + I

15 + I

14 I I

13 I I

12 + I I

11 - + I I

10 I + - I I

9 I + - I I

8 I I I I I

7 I I I I I +

6 I + I I I + I +

5 I + I I I + I +

4 I I I I - + I I I I - +

3 I I I I I I I I I I I I

2 I I I I I I I I I I I I

1 I I I I I I I I I I I I

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

Class 1 2 3 4 5 6 7 8 9 10 11 12

 

Twelve months projected sales versus actual sales, in thousands of dollars.

A positive sign (+) implies projected exceeded actual.

A negative sign (-) implies actual exceeded projected.