MATLAB Function Reference
  Go to function:
    Search    Help Desk 
bar3, bar3h    Examples   See Also

Three-dimensional bar chart

Syntax

Description

bar3 and bar3h draw three-dimensional vertical and horizontal bar charts.

bar3(Y) 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 1 to length(Y). When Y is a matrix, the x-axis scale ranges from 1 to size(Y,2), which is the number of columns, and the elements in each row are grouped together.

bar3(x,Y) draws a bar chart of the elements in Y at the locations specified in x, where 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.

bar3(...,width) sets the width of the bars and controls the separation of bars within a group. The default width is 0.8, so if you do not specify x, bars within a group have a slight separation. If width is 1, the bars within a group touch one another.

bar3(...,'style') specifies the style of the bars. 'style' is 'detached', 'grouped', or 'stacked'. 'detached' is the default mode of display.

bar3(...,LineSpec) displays all bars using the color specified by LineSpec.

h = bar3(...) returns a vector of handles to Patch graphics objects. bar3 creates one Patch object per column in Y.

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.

Examples

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 cool colormap:

See Also

bar, LineSpec, patch



[ Previous | Help Desk | Next ]