`Area`

Area of a histogram plot

**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.**

Optional | Non-negative real number |

Objects | Area Default Values |
---|---|

`plot::Histogram2d` | `0` |

`Area`

determines whether bars of a histogram
plot are scaled with respect to their heights or with respect to their
areas, and by how much.

By default, the bars of a histogram plot use a height that is
equal to the absolute number of data points in he corresponding cell.
Using `Area`

, the user can change this behavior to
make the *areas* of the bars proportional to this
number.

For any distribution with a continuous quantile, we can define,
using `stats::equiprobableCells`

, a list of *n* cells
where each cell is “hit” with the same probability, . By the law
of large numbers, we expect the number of elements in each cell to
be approximating for
large values of *N*,
the number of samples:

X := stats::normalRandom(10, 1): cells := stats::equiprobableCells(40, stats::normalQuantile(10, 1)):

N := 1000: data := [X() $ i = 1..N]: plot(plot::Histogram2d(data, Cells = cells))

N := 10000: data := [X() $ i = 1..N]: plot(plot::Histogram2d(data, Cells = cells))

On the other hand, if we want to display a histogram as an approximation
to the probability distribution, we want not the height, but rather
the area of the rectangles to correspond to our measurements. Moreover,
the sum of all areas should be 1,
so we set `Area`

to this value:

plot(plot::Histogram2d(data, Cells = cells, Area = 1))

plot(plot::Histogram2d(data, Cells = cells, Area = 1), plot::Function2d(stats::normalPDF(10,1)(x), x = 7..13, Color = RGB::Black, LineWidth = 0.5))