Graphics Previous page   Next Page

Stacked Bar Graphs to Show Contributing Amounts

Bar graphs can show how elements in the same row of a matrix contribute to the sum of all elements in the row. These types of bar graphs are referred to as stacked bar graphs.

Stacked bar graphs display one bar per row of a matrix. The bars are divided into n segments, where n is the number of columns in the matrix. For vertical bar graphs, the height of each bar equals the sum of the elements in the row. Each segment is equal to the value of its respective element.

Redefining Y

Create stacked bar graphs using the optional 'stack' argument. For example,

creates a 2-D stacked bar graph, where all elements in a row correspond to the same x location.

Horizontal Bar Graphs

For horizontal bar graphs, the length of each bar equals the sum of the elements in the row. The length of each segment is equal to the value of its respective element.


Previous page  Types of Bar Graphs Specifying X-Axis Data Next page

© 1994-2005 The MathWorks, Inc.