Interpretation of the classes in 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.
CellsClosed determines whether the classes
used in a histogram are intepreted
as semi-open intervals that are closed at the left or the right boundary.
The graphical primitive plot::Histogram2d tallies
numerical data into cells (“classes”) that are defined
by the attribute
[a_1 .. b_1, a_2 ..
b_2, dots]. By default, these classes are interpreted as
a collection of semi-open intervals that are closed
at the right boundary. A data item
x is tallied
into the i-th cell if it satisfies
x ≤ bi. With the option
classes are interpreted as the semi-open intervals that are closed
at the left boundary.
We create a sample of 15 data points:
data := [1, 2, 2, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 5]:
These data are to be tallied into the following cells (classes):
cells := [0 .. 1, 1 .. 2, 2 .. 3, 3 .. 4, 4 .. 5, 5 .. 6]:
With the default setting
the 6 classes are the intervals , etc. The interval contains one
of the data items, the interval contains two,
plot(plot::Histogram2d(data, Cells = cells))
the 6 classes are interpreted as the intervals , etc. Now,
the first class contains none
of the data items, the second class contains one
plot(plot::Histogram2d(data, Cells = cells, CellsClosed = Left))
delete data, cells: