# hist

Histogram plot (not recommended; use `histogram`

)

`hist`

is not recommended. Use `histogram`

instead.

**For more information, including suggestions on updating code, see Replace Discouraged Instances of hist and histc.**

## Description

`hist(`

creates a histogram bar chart of the
elements in vector `x`

)`x`

. The elements in `x`

are sorted
into 10 equally spaced bins along the *x*-axis between the minimum and
maximum values of `x`

. `hist`

displays bins as
rectangles, such that the height of each rectangle indicates the number of elements in the
bin.

If the input is a multi-column array, `hist`

creates histograms for
each column of `x`

and overlays them onto a single plot.

If the input is of data type `categorical`

, each bin is a category of
`x`

.

`hist(`

sorts
`x`

,`xbins`

)`x`

into bins with intervals or categories determined by the vector
`xbins`

.

If

`xbins`

is a vector of evenly spaced values, then`hist`

uses the values as the bin centers.If

`xbins`

is a vector of unevenly spaced values, then`hist`

uses the midpoints between consecutive values as the bin edges.If

`x`

is of data type`categorical`

, then`xbins`

must be a categorical vector or cell array of character vectors that specifies categories.`hist`

plots bars only for those categories.

The length of the vector `xbins`

is equal to the number of
bins.

`hist(`

plots into the axes
specified by `ax`

,___)`ax`

instead of into the current axes
(`gca`

). The option `ax`

can precede any of the input
argument combinations in the previous syntaxes.

## Examples

## Input Arguments

## Output Arguments

## Extended Capabilities

**Introduced before R2006a**