
The total length of each stacked bar is the same as before, but now we can see how the secondary groups contributed to that total. Each bar is now comprised of a number of sub-bars, each one corresponding with a level of a secondary categorical variable. We want to move to a stacked bar chart when we care about the relative decomposition of each primary bar based on the levels of a second categorical variable. A stacked bar chart also achieves this objective, but also targets a second goal. One bar is plotted for each level of the categorical variable, each bar’s length indicating numeric value.

The main objective of a standard bar chart is to compare numeric values between levels of a categorical variable. The Strawberry Mall location appears to have a lower proportion of revenue attributed to equipment, while equipment has a larger share for Peach St. We can see that for most locations, clothing is quite a bit larger in sales than equipment, which in turn is larger than accessories. Each bar is subdivided based on levels of the second categorical variable, department. location has the highest revenue and Apple Rd. The primary categorical variable is store location: we can see from the sorted overall bar heights that the Cherry St. The stacked bar chart above depicts revenue from a fictional fitness retailer for a particular period of time, across two categorical variables: store location and department. Each bar in a standard bar chart is divided into a number of sub-bars stacked end to end, each one corresponding to a level of the second categorical variable.


The stacked bar chart (aka stacked bar graph) extends the standard bar chart from looking at numeric values across one categorical variable to two.
