Stacked area charts work great when charting raw values, averages, counts, and percentage of total. The sum of the values across the different groups will add up to that of the entire set.

But what about in the case when the value being charted is a Median, Geo Mean, or any Percentile? In these cases the sum of the values (say Media) across the categories will not add up to the Median value of the entire set.

Example: We have the data on the consumption of Meat, Vegetables, Fruits, and Dairy for a country. For each category (and the entire set) we have the median pounds consumed per person, each year, for the last 10 years. If we were to draw them in a stacked area chart, the sum of the values for a given year would not equal the median pounds consumed per person across all the categories.

Is it fair to assume that the stacked charts should be avoided in these cases as they will cause confusion?

  • 1
    $\begingroup$ I would agree with you on that. $\endgroup$ Jun 1, 2012 at 2:43
  • $\begingroup$ with regard to your first sentence, how would a stacked area chart work with an average? The essence of a stacked area chart is that you can add the values together and I don't see how that would apply to most series of averages. $\endgroup$ Jun 1, 2012 at 5:56
  • $\begingroup$ To the issue of stacked charts (as opposed to the measure your charting), they tend to work well for showing totals, so if that's your focus and the relative size of the components is secondary they'll be ok. However, if you want to compare the components beware that the shifting of the base of each component (as it's the top of the previous component) makes them hard to compare directly. You could consider panel/small multiples to accomplish the same thing with more clarity. $\endgroup$
    – dav
    Jun 1, 2012 at 13:48
  • 1
    $\begingroup$ What is the question you are trying to illustrate using this chart? $\endgroup$
    – dimitriy
    Jun 5, 2012 at 13:10

2 Answers 2


You already answered your own question: you shouldn't use a stacked area plot for any statistic for which the the statistic of the total is not the unweighted sum of the statistics over the component categories. In other words, the statisitic must be a linear operator. The arithmetic average, count, and total are all linear operators, but the median, geometric mean, and most other statistics aren't.

However, in your example case, I doubt that the difference would be massively noticable just from visual inspection from a plot. Have you tried plotting it to see what happens? You could plot the stacked area chart of the median, then plot a line with the true median over the top.

BTW, does this dataset exist? It would be quite a useful teaching tool, and would make a great addition to R's dataset package.


The simplest rule is that it is incorrect to use a stacked area chart on any day of the week ending in a 'y' (may need modification if used outside of English speaking locales).

If you are interested in the total, then plot the total and don't include the chartjunk formed by the other groups.

In a stacked area chart you may be able to interpret the total and you may be able to interpret the line that is on the bottom, but it is very difficult to interpret the other lines, you need to judge the difference between the line and the one below it which is much harder than than just looking at individual lines. If you are interested in the individual lines then plot them against a common scale, not distorted by stacking. If you don't care about the individual lines then they are distorting and distracting chartjunk.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.