bar3

Draws a 3-D bar chart.

Category: Graphics > 2-D and 3-D Plots

Syntax

bar3(Z)

Draws one 3-D bar per element of Z, positioned by row and column.

bar3(Y, Z)

Places the rows of Z at the positions in Y.

bar3(___, width)

Sets the bar width.

h = bar3(___)

Also returns the graphics objects.

Description

Each element of a matrix becomes a box, so a 3-by-3 matrix gives nine bars arranged on a grid. The chart can be rotated with the mouse in the app. Use bar3h for the variant with horizontal bars.

Input arguments

Z
Matrix of bar heights.
Y
Positions along the row axis.
width
Relative bar width, between 0 and 1.

Output arguments

h
Graphics objects for the bars.

Example

A magic square

bar3(magic(4))
xlabel('Column')
ylabel('Row')
zlabel('Value')

In the app, the figure is drawn below the code.

Notes

The 'stacked' and 'grouped' style strings are not accepted.

See also

bar bar3h surf histogram2