61

I and my colleague have a difference of opinion.

We are creating a chart of, lets say, fruits. Like this one:

enter image description here

But what if the value of oranges is 0%? Do we show the legend anyway? Like this:

enter image description here

Or do we leave it out? Like this:

enter image description here

We have a dashboard with a bunch of these kind of charts. One of us wants to keep the legend of oranges to keep the design consistent (all charts have three values), and the other one wants to keep it clean and only show the information that is truly important. All charts show the same three fruits, but with different values of course.

17
  • 88
    A perfect example of why pie charts are not really that great at visualising data.
    – JonW
    Commented May 11, 2016 at 12:48
  • 4
    That all depends on available space, type of data etc. In my experience, pie charts are really only actually useful for comparing 2 data items. But even then it's an issue with 0% items. If 0 is going to be a possible result then probably something like a simple bar chart is better. Also have a look at this question: ux.stackexchange.com/questions/76021/…
    – JonW
    Commented May 11, 2016 at 13:12
  • 2
    DO you have the option to include values in the legend? e.g. Apples (21%), Melons (79%), Oranges (0%)
    – Dave Haigh
    Commented May 11, 2016 at 13:42
  • 10
    "the other one wants to keep it clean and only show the information that is truly important" A pie chart is for comparing relative values. While comparing relative sizes, what makes 0% less important than 10%, 25%, 50%, 75%, etc? Nothing. Saying 'This has 55%, that has 45%' is just as important as saying 'This has 100%, that has 0%'.
    – Shane
    Commented May 11, 2016 at 20:04
  • 10
    @JonW, "pie charts are not really that great at visualising data" they are a specialized tool, and like any tool there are cases where they're useful. Pie charts are overused, but that doesn't make them bad at visualizing data, it makes them bad at visualizing the types of data pie charts were not designed to visualize. They're good at showing a high-level view of parts that make up a whole, they're not good at showing nuanced comparisons between values.
    – zzzzBov
    Commented May 12, 2016 at 21:14

10 Answers 10

81

Show the numbers.

If the user selected three fruits to be shown, Apples, Oranges, and Melons, and only sees Apples and Melons in the pie and in the legend, they will wonder where the Oranges went. If the Oranges are shown in the legend but not in the pie, again they will look for the tiny slice of Orange with a magnifying glass.

Therefore, show the numbers, confirming to the user that, yes, they did select Oranges as well, but there just aren't any.

A way of doing this would be "disabling" the Oranges in the legend (greying them out) and appending "(none)", "(not shown)", or something similar.

4
  • 4
    The numbers will also help if two categories are a similar size, but users need to know which is bigger (but I'm not sure about greying-out: just "0" or "none").
    – TripeHound
    Commented May 11, 2016 at 15:53
  • 3
    I think greying the color is a very good idea, particularly if it's likely that several items will be selected, and more than one may turn out to be zero. If three items out of a larger group all have 0%, then giving them the same grey color helps communicate and avoids distracting extra colors that won't be found in the chart.
    – recognizer
    Commented May 11, 2016 at 19:59
  • 2
    Having to show the numbers is another example of why Pie Charts are an awful form of data visualisation. With Pie Charts is so incredibly hard to tell what the numbers are without the numbers, you need to add them. The correct solution is to not use a pie chart. Commented May 12, 2016 at 8:50
  • 1
    You're assuming a level of interaction that is not included in the original question - what if the charts are just displaying the data because the user selected 'fruit' rather than choosing the individual items to be displayed? What if the data shows fruit sales for last year (i.e. the data is unchanging)? What if the data shows fruit sales as they are happening (i.e. constantly changing)? There are too many requirements here to give a definite answer one way or the other. Commented May 12, 2016 at 9:02
49

How about his. show the percentage in the legend:

  • Apples (20%)
  • Melons (80%)
  • Oranges (0%)
2
  • 5
    actually, the original idea was to show the percentage in the graph and the number in the legend... like: just having a percent in the graph, in connection to the right area, and the "○ 25 apples" in the legend... Since I think the user will need both of them
    – efrethe
    Commented May 11, 2016 at 14:53
  • 4
    Then, remove the pie chart to increase ink-to-data ratio. Commented May 13, 2016 at 20:36
28

Yes, show it. The data IS important.

Others gave given good reasons (the inclusion of Oranges clarifies they HAD been taken into account) and suggestions (show percentages or numbers, show a thin line if >0 but v. low).

Here is a clearer example of why it would be a bad idea to not include zero-sized elements in the legend:

Assume we have 0 apples, as well.
0% apples, 0% oranges 100% melons
What does that chart tell us, exactly? What is its purpose?

[edit] deduced from comments: The policy of omitting 0-size groups from the legend can amplify confusion as to whether it is, in fact, a pie chart and not, say, an image of a melon ;)
Melons. That's what they look like. Melons. That's what they look like.

8
  • 3
    That's a green circle, not a pie chart.
    – Bálint
    Commented May 12, 2016 at 8:50
  • 2
    It tells us pie charts are pants. Commented May 12, 2016 at 8:50
  • 5
    @Bálint It technically is divided into slices, just the slices for Oranges and Apples are of zero size.
    – DasBeasto
    Commented May 12, 2016 at 12:06
  • 2
    A pie before you slice it is still a pie. And if I eat it whole, it also is a pie.... WAS a pie. Anyway, I agree with this answer, although the last part doesn't work as soon as you throw bananas in the mix.
    – GolezTrol
    Commented May 12, 2016 at 15:26
  • 3
    With your examples I instantly had to think of illustrated pie charts like thumb1.shutterstock.com/display_pic_with_logo/2727232/273050930/… Commented May 12, 2016 at 23:14
21

Don't use a pie chart

Your problem stems from the fact you're using a pie chart. Pie charts are simply not a very good way of representing data (see here, here, here or here for some discussions of why) and you've stumbled on one of the reasons why: they can't represent data with a value of 0. They're also almost impossible to accurately read the values off which is why you so often see them annotated with the actual values - this alone should tell you they're a bad form of data representation, good representations don't require you to redundantly repeat yourself.

Instead use a bar chart

I spent two seconds knocking these up on Excel but they illustrate the point - your data is now easy to read even with zero values and your user can accurately read off more or less exact values for each of the states:

Excel example bar chart

7
  • 2
    As i told JonW yesterday, I would like the user to get the impression of a monitoring dashboard, like "its going well" or "something has gone wrong". In my opinion the bar chart is more about viewing statistics, like "you cant do anything about this, just observe". I would like to give the user the impression "OMG, this is not going well, i have to do something". In my fruit example, it would probably mean that nobody likes apples, if apples exists we have to get rid of them, fast!
    – efrethe
    Commented May 12, 2016 at 14:55
  • 3
    If your values dynamically change as they do things this will be communicated; there's nothing about a pie chart that means it communicates that something is dynamic more effectively. Moreover, it seems like you're actually asking about something different from that question you've outlined, perhaps if you gave us a clear explanation of what you actually want we would be better placed to give better suggestions on how to do it? Commented May 12, 2016 at 15:02
  • For example, if you want to go with the dashboard theme you could maybe show one of the values as a dial, complete with a red 'danger' zone and a flashing warning light or that might be completely inappropriate, we can't tell because you haven't asked a question that explains what you're doing. Commented May 12, 2016 at 15:03
  • 2
    What if the value for Oranges was 0.01%? I think the bar chart doesn't necessarily solve the problem of not being able to see very small values when compared with large values, regardless of the chart type.
    – Michael Lai
    Commented May 12, 2016 at 21:49
  • 1
    @MichaelLai the bar chart adequately gives an approximation of the amount of oranges whether it is 0% or 0.01%. No requirement to be able to distinguish a very small value from 0 is given.
    – user31143
    Commented May 13, 2016 at 12:10
14

Definitely keep it in the legend.

If you only have the two items in the legend it looks like you created a chart to show the comparison of Apples and Melons. For all the user knows there could be twice as many Oranges and you simply didn't include them in this data. Since Oranges are included you need to show that.

A second reason would be if the user manually selects these categories to compare. If the user selects "Show me Oranges, Melons, and Apples" and you return a chart with just Melons and Apples they are going to assume the tool is broken.

A good middle ground would be to include Oranges in the legend but give it a "disabled" or lower opacity style, to imply that there aren't any.

1
  • 7
    Not sure on greying it out as that may imply it is not included in the chart and could be turned on and included some how. I would follow your suggestions excluding the greying out, and then show the numbers in the legend as SQB suggested
    – Dave Haigh
    Commented May 11, 2016 at 13:40
2

I would suggest that if "0% oranges" is the main point of significance, then the pie chart is the wrong way to display the data. If, on the other hand, 0% oranges is no more significant than (say) 1% oranges, because you know your standard deviation is a fraction of a percent or larger, then I'd display a thin orange radius so readers don't think there's a printing error! And the form without oranges in the key is outright confusing if you start saying anything at all about oranges in your text.

2

The answer here depends on how the charts are being used.

If the charts are historically factual (the data that they represent is fixed and will not change over time), extra legend entries for zero values are just noise that gets in the way of the users understanding of the chart.

However, if the charts are constantly changing, you need to signal to your users that the items that currently have zero values are being monitored too and may appear on the chart. The most understandable way to do this would be to include those items in the legend.

2

If you have a bar chart and one of the columns is empty you don't hide the column (and the consequently the connected label). The same should be true for the pie chart.

However, interestingly Google charts does the opposite and actually hides it by default - see this jsfiddle of a pie chart where the percentage of time for eating is zero.

enter image description here

3
  • Why do you think it is wrong? I think Excel doesn't hide it by default, but I'd be surprised if Microsoft and Google shared the same view on too many things :D
    – Michael Lai
    Commented May 12, 2016 at 21:59
  • 1
    @MichaelLai for the reasoning I gave in the first sentence - it makes sense to me that it should match a bar chart where you don't remove the column and its label if the value is empty
    – icc97
    Commented May 13, 2016 at 7:09
  • 3
    Whether it is "wrong" to hide the zero value is entirely context-dependent. Often a pie chart is communicating "what stuff makes up the whole?" and the 0% is not relevant information.
    – user31143
    Commented May 13, 2016 at 12:08
0

We've already established that the person who asked the question wants a pie chart, so the answer should be focused on how to represent the information and values in that chart (whether it should be used or not is another consideration altogether). So in addressing that point, you could look at two things:

  • Adding labels where appropriate (this could be on the legend or somewhere else)
  • Adding values where appropriate (this could be on the chart or somewhere else)

There are a large number of Microsoft Excel defaults that illustrates this:

enter image description here

So why not simply test it out with people and see which one they think will be the clearest and easier to understand?

0

Many pie charts have a few wedges which add up to more than 99%, plus a few other values which make up the remaining 1%. A normal way to handle those is to have an "everything else" wedge whose width is artificially forced large enough to be visible (maybe 0.2% or so), and then have a call-out listing the contents of that wedge. Such an approach would seem perfectly natural even if one of the data points represented a value of 0.00001%, and I don't think a value of zero would need to be treated any differently.

3
  • A helpful idea for small percentages. However, if you only have a zero value, there isn't "anything else". I don't think a wedge of any thickness makes sense.
    – user31143
    Commented May 16, 2016 at 9:47
  • @dan1111: The trivial-width wedge would appear pretty much as a line, whose location would be identified by the call-out. If there were just a single isolated pie chart, it wouldn't make much sense to have such a call-out, but if there were a sequence of charts, keeping consistent labels and having a call-out to identify a a place-holder for a data item that is/was non-zero in other charts would be helpful.
    – supercat
    Commented May 16, 2016 at 13:25
  • @dan1111: Depending upon what is being represented, it may make more sense to have something placed like a call-out, but not pointing at anything, for things which are "qualitatively zero" as opposed to "unmeasurably small", but my point is that it makes sense to use call-outs when things get small and non-zero, and if any such call-outs exist, the concept works fine even if things diminish to immeasurable nothingness.
    – supercat
    Commented May 16, 2016 at 13:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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