Documentation

# `Cells`

Classes of histogram plots

MuPAD® notebooks will be removed in a future release. Use MATLAB® live scripts instead.

MATLAB live scripts support most MuPAD functionality, though there are some differences. For more information, see Convert MuPAD Notebooks to MATLAB Live Scripts.

## Value Summary

 Mandatory List of arithmetical expressions

## Graphics Primitives

ObjectsCells Default Values
`plot::Histogram2d`[`7`]

## Description

`Cells` determines the number and position of the classes used in a histogram.

`Cells` accepts either a single positive integer (or, equivalently, a list of one positive integer) or a list of cells given as ranges or lists of two elements.

A single integer n in the specification `Cells = n` or ```Cells = [n]``` is interpreted as “subdivide the range of data into n cells of equal size.”

The number n can be animated. In this case, n may be a symbolic expression of the animation parameter.

The cells may be specified directly as in ```Cells = [[a1, b1], [a2, b2], …]``` or `Cells = [a_1..b_1, a_2..b_2, Symbol::dots]`.

### Note

The i-th cell is the semi-open interval , i.e., a datum x is tallied into the i-th cell if ai < xbi is satisfied.

The cell boundaries must satisfy a1 < b1a2 < b2a3 < …. In most applications, b1 = a2, b2 = a3 etc. is appropriate.

If giving cells directly, the leftmost border may be ```- infinity``` and the rightmost border may be `infinity`. These rectangles will then be adjusted according to the average widths of the other rectangles for display purposes.

With the attribute `CellsClosed` = `Left`, the cells `[a_1..b_1, a_2..b_2, Symbol::dots]` are interpreted as the semi-open intervals .

## Examples

### Example 1

We create a sample of 1000 data points and plot a histogram of them:

```X := stats::fRandom(100, 10): data := [X() \$ i = 1..1000]: plot(plot::Histogram2d(data))```

The shape of the distribution becomes much better visible when we increase the number of cells:

`plot(plot::Histogram2d(data, Cells = 40))`

```plot(plot::Histogram2d(data, Cells = [40], Area = 1), plot::Function2d(stats::fPDF(100,10)(x), x = 0 .. 5, Color = RGB::Black))```

With cells of different widths, setting `Area` to a positive value is highly recommended, to still have the histogram follow the probability distribution:

```cells := stats::equiprobableCells(50, stats::fQuantile(100, 10))```
`plot(plot::Histogram2d(data, Cells = cells)):`

```plot(plot::Histogram2d(data, Cells = cells, Area = 1), plot::Function2d(stats::fPDF(100, 10)(x), x = 0 .. 5, Color = RGB::Black))```