FUNCTION REFERENCE
histogram
Histogram plot.
Histogram plot.
Syntax
h = histogram(X)Syntax
h = histogram(X, nbins)Syntax
h = histogram(X, edges)Syntax
h = histogram(..., Name, Value)Bins all elements of X and draws one bar per bin. Bins are [edges(k), edges(k+1)) and the last bin is closed; NaN values are not counted. Automatic bins: integer data spanning at most 50 gets one bin per integer, other data Scott's rule with "nice" edges. BinLimits [lo hi] with NumBins n gives n equal bins over the limits; BinWidth w alone aligns the edges to multiples of w. Options: NumBins, BinEdges, BinWidth, BinLimits, BinMethod, Normalization (count, probability, pdf, cdf, countdensity, cumcount), DisplayStyle (bar or stairs), FaceColor, EdgeColor, FaceAlpha, DisplayName and LineWidth. The handle answers get for Values, BinCounts, BinEdges, NumBins, BinWidth, BinLimits, Normalization, BinMethod, DisplayStyle, Data, FaceColor and FaceAlpha; set recomputes the bins.
Example
h = histogram([1 2 2 3 3 3]); get(h, 'Values') % [1 2 3]Example
h = histogram(randn(1, 200), 'Normalization', 'pdf', 'NumBins', 12);Differences from MATLAB: FaceAlpha is drawn as an opaque tint toward white. The probability, pdf and cdf normalizations divide by numel(X). Categorical data and the Orientation property are not supported.
These are the engine’s help pages. Each page keeps its compatibility notes. File operations are unavailable in the browser.