|
Contents | Previous | Next | Subchapters |
| Syntax |
ghist(y) y, nb) y, nb, color) y, nb, color, cindex) |
| See Also | gstair , gbar |
The real or double-precision column vector y
contains the data values that are being plotted.
If the argument nb is present,
the row dimension of y must be greater than or
equal to nb.
Otherwise, the row dimension of y must be greater than
or equal to ten.
If integer scalar nb is present, it
specifies the number of bins in the histogram.
Otherwise there are ten bins in the histogram.
If the character matrix color is present,
it specifies the plotting colors for the histogram.
Each row of color must contain
a valid O-Matrix plotting color; i.e.,
"black", "maroon", "green", "olive", "navy",
"purple", "teal", "gray", "silver", "red", "lime", "yellow",
"blue", "fuschia", or "aqua".
If the integer column vector cindex is present,
it specifies which elements of y correspond to which
colors in the histogram. The element y(i)
corresponds to the color color.row(cindex(i)).
Each element of cindex must have a value between
one and the row dimension of color.
y = rand(499, 1)
nb = 20
ghist(y, nb)
O-Matrix will plot a histogram of 499 samples
that are uniformly distributed between zero and one.
The following program plots a similar histogram in
which the even indices correspond to "green"
and the odd indices correspond to "red".
clear
#
y = rand(499, 1)
nb = 20
color = {"red", "green"}
even = mod(seq(499), 2) == 0
odd = not even
cindex = odd % fill(1, 499, 1) + even % fill(2, 499, 1)
ghist(y, nb, color, cindex)