N = fewerbins(h) decreases
the number of bins in histogram h by 10% (rounded
down to the nearest integer) and returns the new number of bins.
For bivariate histograms, this decreases the bin count in both
the x and y directions.
N = fewerbins(h,direction),
where h must be a histogram2 object,
only decreases the number of bins in the dimension specified by direction.
The direction option can be 'x', 'y',
or 'both'. The default value is 'both'.
Plot a histogram of 1,000 random numbers and return a handle to the histogram object.
x = randn(1000,1);
h = histogram(x)
h =
Histogram with properties:
Data: [1000×1 double]
Values: [1×23 double]
NumBins: 23
BinEdges: [1×24 double]
BinWidth: 0.3000
BinLimits: [-3.3000 3.6000]
Normalization: 'count'
FaceColor: 'auto'
EdgeColor: [0 0 0]
Use GET to show all properties
Use fewerbins to decrease the number of bins in the histogram.
h — Input histogram histogram object | histogram2 object
Input histogram, specified as a histogram or histogram2 object.
For more information, see histogram or histogram2.
h cannot be a categorical histogram.
direction — Direction to decrease number of bins 'both' (default) | 'x' | 'y'
Direction to decrease the number of bins, specified as 'x', 'y',
or 'both'. Specify 'x' or 'y' to
only decrease the number of bins in that direction while leaving the
number of bins in the other direction constant.
Number of bins, returned as a scalar or vector. N is
the new number of bins for the histogram after increase. For bivariate
histogram plots, N is a two-element vector, [nx
ny].