Skip to content

histogram

Histogram of data.

h = histogram(x, ...)
h = histogram(x, nbins, ...)
h = histogram(x, edges, ...)

Bins the values in x and draws a bar chart of the counts. With an integer nbins, uses that many equal-width bins; with a vector edges, uses those bin boundaries explicitly.

histogram(randn(1000, 1))
histogram(x, 50, 'Normalization', 'pdf')
  • bar — Vertical bar chart.
  • frequency — Frequency distribution (counts in bins).