Orientation of boxes and bars

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

OptionalHorizontal or Vertical

Graphics Primitives

ObjectsDrawMode Default Values
plot::Bars2d, plot::Boxplot, plot::Histogram2dVertical


DrawMode = Vertical versus DrawMode = Horizontal determines the orientation of boxes in a box plot and bars in bar plots and histogram plots.

A plot of type plot::Boxplot serves for visualizing and comparing statistical data samples. The plot reduces the data to few simple descriptive parameters.

One coordinate direction provides information on the statistical data (25% quantile, median, 75% quantile etc.). The other coordinate direction just serves for placing several boxes associated with different data samples side by side for comparison.

With DrawMode = Vertical, the vertical direction provides the information on the statistical data.

With DrawMode = Horizontal, the boxes are turned by 90 degrees. Now, the horizontal direction provides the information on the statistical data.

Corresponding statements hold for the bars in a 2D bar plot of type plot::Bars2d and 2D histograms of type plot::Histogram2d.


Example 1

We create a box plot:

data1 := [2, 6, 4, 3, 1, 7, 9, 5, 3]: 
data2 := [2, 4, 8, 8, 7, 6, 8, 7, 3, 1, 10]: 
data3 := [stats::normalRandom(6, 2)() $ k = 1 .. 100]: 
plot(plot::Boxplot(data1, data2, data3, Notched = TRUE)):

The boxes are rendered horizontally:

plot(plot::Boxplot(data1, data2, data3, Notched = TRUE,
                   DrawMode = Horizontal)):

delete data1, data2, data3:

See Also

MuPAD Functions