Cross Validated is a question and answer site for people interested in statistics, machine learning, data analysis, data mining, and data visualization. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question
I would agree with you on that. – Michael Chernick Jun 1 '12 at 2:43
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. – Peter Ellis Jun 1 '12 at 5:56
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. – dav Jun 1 '12 at 13:48
What is the question you are trying to illustrate using this chart? – Dimitriy V. Masterov Jun 5 '12 at 13:10

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.

share|improve this answer
I always like reading your answers. – mark999 Nov 22 '12 at 8:40

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.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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