Graphics Previous page   Next Page

Histograms

MATLAB histogram functions show the distribution of data values. The functions that create histograms are hist and rose.

Function
Description

hist

Displays data in a Cartesian coordinate system

rose

Displays data in a polar coordinate system

The histogram functions count the number of elements within a range and display each range as a rectangular bin. The height (or length when using rose) of the bins represents the number of values that fall within each range.

Histograms in Cartesian Coordinate Systems

The hist function shows the distribution of the elements in Y as a histogram with equally spaced bins between the minimum and maximum values in Y. If Y is a vector and is the only argument, hist creates up to 10 bins. For example,

generates 10,000 random numbers and creates a histogram with 10 bins distributed along the x-axis between the minimum and maximum values of yn.

Matrix Input Argument

When Y is a matrix, hist creates a set of bins for each column, displaying each set in a separate color. The statements

create a histogram showing 10 bins for each column in Y.


Previous page  Removing a Piece from a Pie Chart Histograms in Polar Coordinates Next page

© 1994-2005 The MathWorks, Inc.