Skip to Main Content Skip to Search
Product Documentation

bar3h - Plot horizontal 3-D bar graph

Alternatives

To graph selected variables, use the Plot Selector in the Workspace Browser, or use the Figure Palette Plot Catalog. Manipulate graphs in plot edit mode with the Property Editor. For details, see "Plotting Tools — Interactive Plotting" in the MATLAB Graphics documentation and "Creating Graphics from the Workspace Browser" in the MATLAB Desktop Tools and Development Environment documentation.

Syntax

bar3h(Y)
bar3h(x,Y)
bar3h(...,width)
bar3h(...,'style')
bar3h(...,LineSpec)
bar3h(axes_handle,...)
h = bar3h(...)

Description

bar3h draws three-dimensional horizontal bar charts.

bar3h(Y) draws a three-dimensional bar chart, where each element in Y corresponds to one bar. When Y is a vector, the y-axis scale ranges from 1 to length(Y). When Y is a matrix, the y-axis scale ranges from 1 to size(Y,1) and the elements in each row are grouped together.

bar3h(x,Y) draws a bar chart of the elements in Y at the locations specified in x, where x is a vector defining the y-axis intervals for horizontal bars. The x-values can be nonmonotonic, but cannot contain duplicate values. 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.

bar3h(...,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.

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

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

bar3h(axes_handle,...) plots into the axes with the handle axes_handle instead of into the current axes (gca).

h = bar3h(...) returns a vector of handles to patch graphics objects, one for each created. bar3 creates one patch object per column in Y. When Y is a matrix, bar3h creates one patch graphics object per column in Y.

Examples

Compare two 3–D bar graphs where style is specified as 'detached' and width is varied. This type of graph helps in visualizing trend of each row in the input data.

load count.dat;
y = count(1:10,:); % Loading the dataset creates a variable 'count' 
figure; subplot(1,2,1);
bar3h(y,'detached');
title('Detached');
subplot(1,2,2);
bar3h(y,0.5,'detached');
title('Width = 0.5');

Create a graph where width is varied and style is 'grouped'. The 'grouped' graph gives a better visualization for variation of data at each point.

figure; subplot(1,2,1);
bar3h(y,'grouped');
title('Grouped');
subplot(1,2,2);
bar3h(y,0.25,'grouped');
title('Width = 0.25');

Create a 3–D horizontal bar graph with the style option 'stacked' . A 'stacked' graph visualizes the cumulative effect of the data at each data point.

figure; subplot(1,2,1);
bar3h(y,'stacked');
title('Stacked');
subplot(1,2,2);
bar3h(y,0.25,'stacked');
title('Width = 0.25');

See Also

bar | bar3 | barh | LineSpec | patch

How To

  


» Learn more
» Download free kit
» Get trial software

 © 1984-2012- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS