Stacked Area Graphs Are Not Your Friend

Stacked area graphs are not your friend. Seriously. I want to make this abundantly clear.

I’m going to expound on some of the work of Stephen Few here and lay out what stacked area graphs are, why they are a poor type of data visualization, and what are some good alternatives.

What is a stacked area graph?

A stacked area graph depicts a quantitative variable against another quantitative variable (usually time as the independent variable, i.e. on the x-axis), broken up across more than one categorical variables (or into different “data series” in MS Excel’s parlance) which make up the whole. The different shaded areas are stacked on top of one another, so that the height of each shaded area represents the value for each particular categorical variable, and the total height is their sum.
For example, you can depict a quantity of interest, Y, across four groups, creatively entitled A, B, C, and D, with the combined height being the total:
Pretty, no?
So what’s wrong with that? A good looking graph right? Shows all the relevant quantities as well as their total in the same figure. Maybe. Let’s look in detail at some of the problems with interpreting this type of graph.

Shortcomings of Stacked Area Graphs

The problem with stacked area graphs is that of baselining. When we compare multiple lines in a line graph which are comparing from the same baseline which is the value of the y-axis where it intersects the x.
With a stacked area graph, it is easy to accurately interpret both the relative values (as graphs are not meant to read off exact values – that is a job for tables) as well as the overall trending of the total across all four groups.
It is also easy to interpret this for the data which happens to be at the bottom of the “stack” as it has the x-axis as its base (in this case, the value for Group A).
The problem arises for the stacked areas. Their baselines are the curve of the top of the areas below. Ideally one should be able to interpret each individual series by its height, but unfortunately this is not usually the case – most interpret the curve of the top of the area as indicating quantity (as one would in a line graph). Because these lines follow the baseline of those below, they make it appear that those above have the same characteristics as below.

For instance, in the example graph I produced above, it can be easy to think there are very well-defined peaks in all the series around Jan 9 and Jan 22. This is because of the effect just mentioned. Look at the same graph if I selectively shuffle the order of the stacking of the areas:

While we still see those peaks at the times mentioned because those are the peaks for the total, but look at the series for Group D (in purple). Do you still feel the same about how it fluctuates between the dates of the 8th and the 22nd as you did before, in the first figure?

Because of the inclination to interpret the top of the area as quantity, interpreting the trend in the different areas of a stacked area graph is usually quite difficult.

Alternative Approaches

So what is the optimal alternative approach? What should you use instead of a stacked area graph? Data visualization expert Stephen Few recommends individual line charts, with an additional line in a stark color (black) for the total. I’ve created that below for our example:
You can see that the overall trend line of the total follows the top of the stacked area graph (it is unchanged) but the individual series look quite different, and while a bit noisy, it is easier to pick out their individual trending behaviors.

When the graph gets a bit noisy like this it might also be a good idea to thin the lines.

Okay, that’s better. But as the number of values of the categorical variable increases the graph is going to get increasingly noisy. What do we do in those cases?

Well, as I often have to remind myself, nowhere does it say that you have to tell your story all in one graph. There’s nothing stopping us from breaking up this one graph into smaller individual graphs, one for each and also the total. The disadvantage here is that it’s not as easy to compare between the different groups, however we can make it easier by using the same axis scaling for the graphs for each individual group.

Here there were an odd number of graphs so I chose to keep the graph for the total larger (giving it emphasis) and maintain their original aspect ratios. You could just as easily make a panel of 6 with equal sizes if you had a different number of graphs, or put them all in tall or wide graphic in a column or row.

Also, now that each individual graph depicts the value for a different group, we don’t need the colours on the figures on the right anymore; that information is in each individual plot title. So we can ditch the color. I’ll keep the total black to differentiate between the total and the value for individual group.

As the number of values for the categorical variable gets very large you go from multiple figures into true small multiple (trellis plot) territory, like in the figure below:

Another option, if you have the benefit of more dynamic visualization tools available, would be to use interactivity and gray out series in the background, such as in this amazing visualization of housing prices from the New York Times:

Click me for dataviz goodness.
So what do stacked area graphs have going for them over the approaches I laid out above? The one thing that all the alternatives I laid out do not allow as easily is the comparison of the relative proportions of the whole.
However, this can also be accomplished by using relative quantities, that is, calculating the percentages of each categorical variable and plotting those, as below. 

This approach also does not suffer from the aforementioned baseline issue, which is the case for proportional stacked area graphs (where the top of the y-axis is 100%). These types of figures are also best avoided.
Attempts to address the fundamental issue with stacked area graphs have been made with a different type of visualization, the streamgraph, however I believe this type of visualization introduces more additional problems in interpretation than it solves.

Concluding Remarks

Though I do like to put together some thoughts on data visualization practice occasionally, it is not my intent to be overly critical of poor visualization choices, as, now that I think about it, my other post was also framed somewhat negatively.
In data visualization, there is no ‘right’ answer; only some visualization techniques that display the data better than others. Different ways of visualizing the data have different strengths and weaknesses; the goal here is to apply critical thought to different types of visualization, so that we may be informed about making good visualization choices in order to best represent that data so that it is not misinterpreted due to our perceptual biases.

In my opinion, and my experience working with data visualization, you are almost always better served by the simpler, more minimalistic types of visualizations (the fundamental three being the bar chart, line graph and scatterplot) than more complicated ones. This has been an example of that, as stacked area graphs are really just a combination of area graphs, which are, in turn, an extension of the line graph.

Though the stacked area graph allows depiction of a total quantity as well as the proportions across a categorical variable making up its whole, I think this quality is not of sufficient benefit given the issues it introduces, as I have noted here. This is especially the case as there are other types of visualizations which accomplish the same goals without as much room for misinterpretation.


Few, Stephen. Quantitative Displays for Combining Time-Series and Part-to-Whole Relationships.

5 thoughts on “Stacked Area Graphs Are Not Your Friend”

Leave a Reply

Your email address will not be published. Required fields are marked *