|MATLAB Function Reference|
Three-dimensional bar chart
bar3h draw three-dimensional vertical and horizontal bar charts.
draws a three-dimensional bar chart, where each element in
Y corresponds to one bar. When
Y is a vector, the x-axis scale ranges from
Y is a matrix, the x-axis scale ranges from
size(Y,2), which is the number of columns, and the elements in each row are grouped together.
draws a bar chart of the elements in
Y at the locations specified in
x is a monotonic vector defining the y-axis intervals for vertical bars. If
Y is a matrix,
bar3 clusters elements from the same row in
Y at locations corresponding to an element in
x. Values of elements in each row are grouped together.
sets the width of the bars and controls the separation of bars within a group. The default
0.8, so if you do not specify
x, bars within a group have a slight separation. If
1, the bars within a group touch one another.
bar3(...,' specifies the style of the bars.
'detached' is the default mode of display.
'detached'displays the elements of each row in
Yas separate blocks behind one another in the x direction.
'grouped'displays n groups of m vertical bars, where n is the number of rows and m is the number of columns in
Y. The group contains one bar per column in
'stacked'displays one bar for each row in
Y. The bar height is the sum of the elements in the row. Each bar is multi-colored, with colors corresponding to distinct elements and showing the relative contribution each row element makes to the total sum.
bar3(..., displays all bars using the color specified by
h = bar3(...)
returns a vector of handles to patch graphics objects.
bar3 creates one patch object per column in
bar3h(...) and h = bar3h(...)
create horizontal bars.
Y determines the bar length. The vector
x is a monotonic vector defining the y-axis intervals for horizontal bars.
This example creates six subplots showing the effects of different arguments for
bar3. The data
Y is a seven-by-three matrix generated using the
Area, Bar, and Pie Plots for related functions
Bar and Area Graphs for more examples