bar3h
Display a 3-D horizontal bar chart.
📝Syntax
bar3h(Y)
bar3h(Z, Y)
bar3h(..., width)
bar3h(..., 'detached')
bar3h(..., 'grouped')
bar3h(..., 'stacked')
bar3h(..., color)
bar3h(parent, ...)
h = bar3h(...)
📥Input Arguments
Parameter Description
Y Numeric vector or matrix of bar lengths.
Z row positions for the bars.
width Relative bar width. The default value is 0.8.
color color name or short color name for the bar faces.
📤Output Arguments
Parameter Description
h surface graphics object or vector of surface graphics objects.
📄Description

bar3h displays horizontal 3-D bars extending from x = 0.

Use 'grouped' to group matrix columns at each row position and 'stacked' to stack matrix columns at each row position.

💡Examples
Detached horizontal 3-D bars from a matrix.
f = figure();
Y = [1 3; 2 4; 5 2];
bar3h(Y);
Example illustration
Horizontal 3-D bars from a vector.
f = figure();
y = [50 40 30 20 10];
bar3h(y);
Example illustration
Horizontal 3-D bars with explicit row positions.
f = figure();
z = [1950 1960 1970 1980 1990];
y = [16 8 4 2 1];
bar3h(z, y);
Example illustration
Horizontal 3-D bars from a matrix.
f = figure();
y = [1 4 7; 2 5 8; 3 6 9; 4 7 10];
bar3h(y);
Example illustration
Horizontal 3-D bars from a matrix with explicit row positions.
f = figure();
z = [1 2 3 4];
y = [1 5 9; 2 6 10; 3 7 11; 4 8 12];
bar3h(z, y);
Example illustration
Horizontal 3-D bars with width and a color.
f = figure();
z = 0:pi/16:pi;
y = [sin(z') / 4, sin(z') / 2, sin(z')];
bar3h(z, y, 1, "r");
Example illustration
Grouped horizontal 3-D bars.
f = figure();
y = [1 2; 3 4; 5 6];
bar3h(y, 'grouped');
Example illustration
Stacked horizontal 3-D bars with positive and negative values.
f = figure();
y = [1 -2; -3 4];
bar3h(y, 'stacked');
Example illustration
🔗See Also
barhbar3surface
Edit this page on GitHub