In the data visualization community, I’m probably best known for experimental projects…for data art, for particle systems inspired by Chemistry and Physics, for audio analysis and mapping, for sharing what I’ve learned while migrating D3 projects to D3.V4.
So why am I writing about pie charts? Because it’s always a good idea to revisit the basics, every so often…and to question our assumptions about those basics.
Developing a data visualization is more than just data structures and algorithms. It’s more than code libraries and tools. It’s important to make time and step away from the code…to understand and follow best practices in data visualization.
For as long as I can remember, I’ve repeated and followed the standard mantra of data visualization: “don’t ever use pie charts”. Why? Well, most of the time they’re just not readable. It’s about how we perceive area, and angles, and more.
But are all pie charts unreadable? Aren’t there any good times to use one? Well, during dinner conversation at a data visualization conference (Tapestry), my assumptions about pie charts were pleasantly challenged. I was genuinely surprised to hear that there actually a few use cases that pie charts are really great for.
I’ll just show a couple that I found interesting.
It’s all about perceiving certain angles, rather than area (which we’re not very good at). We’re able to easily see that 28% is definitely not the same as 25%. So, if we’re monitoring something that should be 25%, a pie chart can help us quickly see if ‘something’s off’. However, we might not be able to tell if it’s 28% and not 27%.
Same goes for 50%. It’s clear when the dividing line is not straight, and this shows us that the portions are not quite even. Again, we’re not really comparing area. It’s the straightness of the line that we are relying on.
If we look at the same data in a stacked bar chart, it’s not as intuitive. Which of the two sets has a 75:25 split? Yes, annotations and labels would help, but the pie chart does a better job here.
These examples have very specific angles, and only two categories. What if we have more categories? And different angles? Well, that’s when the pie chart falls down.
Max Roser recently demonstrated how much easier it is to compare values with bar charts than it is with pie charts.
As pie charts, the three data sets look nearly identical. It’s not until you see the data presented as bar charts that the patterns emerge.
If a chart doesn’t help communicate the patterns in the data, it has failed, and perhaps even lied.
We’ve all seen pie charts used badly. How about pie charts for showing differences between two sets? This is highly problematic. We have difficulty comparing values within a single pie chart. When comparing between two or more sets, pie charts fail. In the example below, it looks like “14–17” is smaller in the second set, and maybe “18–24” is bigger.
If the same data is shown in stacked bar charts, it’s easier to see if one ‘wedge’ of data has changed between the two sets. The view still has the part-of-the-whole aspect of a pie chart, but it’s a little easier to compare the two charts. The ordering of the categories is important here.
While we can see that some values differ between the two groups, they don’t share a common axis and it’s still hard to see how much each value differs…especially if more than two values have changed.
We could improve readability with grouped bar charts. These are easier to compare.
If we really want to show the differences between the two groups, we could group by values instead of sets.
So, what’s the take away? While pie charts are nearly ubiquitous, they’re not very useful most of the time. If you want your charts to be readable, don’t use a pie chart.
For the charts in this article, my source code (in D3.V4) is available online. These might be the only pie charts I’ll ever code. I spent a fair amount of time reshaping the data for the various chart types.
In a lot of these articles, the discussions in the comment section are also very interesting and informative!
by Nathan Yau
by Robert Kosara June 27, 2016
by Robert Kosara / January 12, 2010
- Mentions an alternative to pie chart: “square pie” also called a “waffle chart”.