"Nbins"
, nbins)"Ctrs"
, centers)"Edges"
, edges)Produce bivariate (2D) histogram counts or plots.
The elements to produce the histogram are taken from the Nx2 matrix X. Any row with NaN values are ignored. The actual bins can be configured in 3 different: number, centers, or edges of the bins:
Produces equally spaced bins between the minimum and maximum values
of X. Defined as a 2 element vector, nbins, one for each
dimension. Defaults to [10 10]
.
Defined as a cell array of 2 monotonically increasing vectors, centers. The width of each bin is determined from the adjacent values in the vector with the initial and final bin, extending to Infinity.
Defined as a cell array of 2 monotonically increasing vectors,
edges. N(i,j)
contains the number of elements
in X for which:
The consequence of this definition is that values outside the initial and final edge values are ignored, and that the final bin only contains the number of elements exactly equal to the final edge.
The return values, N and C, are the bin counts and centers respectively. These are specially useful to produce intensity maps:
[counts, centers] = hist3 (data); imagesc (centers{1}, centers{2}, counts)
If there is no output argument, or if the axes graphics handle hax is defined, the function will plot a 3 dimensional bar graph. Any extra property/value pairs are passed directly to the underlying surface object.
See also: hist, histc, lookup, mesh.
The following code
X = [ 1 1 1 1 1 10 1 10 5 5 5 5 5 5 5 5 5 5 7 3 7 3 7 3 10 10 10 10]; hist3 (X)
Produces the following figure
Figure 1 |
---|
Package: statistics