神刀安全网

The correct way to use pie charts

The correct way to use pie charts

Pie charts are the most widely berated chart in data visualization. Many articles have been written over the years describing why pie charts are bad , and why we should no longer use them . Even key members of the data visualization community consider using a pie chart equivalent to using incorrect grammar .

In short, pie charts are the comic sans of data visualization: Many would agree that if you use a pie chart, you immediately betray your lack of data visualization knowledge.

I believe that the reason so many people dislike pie charts is because they’re so frequently misused by amateur practitioners. Furthermore, I believe that pie charts still play an important role in data visualization, and I’m going to make my case in favor of pie charts below. Along the way, I will explain the correct way to use pie charts; please take note and share this information with your colleagues so we can salvage the pie chart’s reputation.

The advantages of pie charts

From my point of view, pie charts have two major advantages over their alternatives:

  1. Pie charts are easy to understand. Even readers who have never taken a statistics course can look at a pie chart and immediately understand what it’s trying to show. This is a vital factor if you are making data visualizations for public consumption.
  2. Pie charts easily communicate a simple proportion. If all you need to communicate is that one category (or the sum of a few categories) represents a simple proportion of a whole, then pie charts will excel at this task.

I will demonstrate these points with a few examples below. First, let’s cover the three most common mistakes that designers make when using pie charts.

Make sure your parts sum to a meaningful whole

By far, the most common mistake with pie charts is representing parts that don’t sum to a meaningful whole. “What is a meaningful whole?,” you ask. Let’s make this concrete with an example.

Say we’re putting together a presentation for our boss and want to demonstrate the popularity of three programming languages as indicated by their Google search frequency. We make the pie chart below and move on with our slides.

What’s wrong with this pie chart?

The correct way to use pie charts

That’s right: R, JavaScript, and Python don’t represent every programming language out there, yet by making them the only “pieces of the pie,” that’s exactly what we’re claiming! In other words, our parts don’t sum to a meaningful whole that represents all Google searches for all programming languages.

To fix this problem, we have to add an “Other programming languages” part to the pie chart, as we have below. Now we’re properly visualizing the relative popularity of our three programming languages.

The correct way to use pie charts

With the pie chart above, we can easily make the point that R, JavaScript, and Python together represent a little less than 1/4 of all Google searches for programming languages.

Note that we’re using the pie chart to make statements about simple proportions of the whole: 1/4, 1/3, 1/2, etc. are fine as simple proportions, but don’t use pie charts to communicate a specific percentage, for example, 32.3333%).

Collapse categories down to 3 or fewer categories that matter

Now let’s say we want to provide a broader picture of all the programming languages that people search for on Google. We make the pie chart below to show the percentage breakdown for all of the programming languages that we’ve been tracking.

What’s wrong with this pie chart?

The correct way to use pie charts

Right again! We went overboard and showed way too many categories at once. Pie charts are not designed to communicate multiple proportions, so we should collapse our categories down to only a handful that really matter — 3 or fewer is the general rule of thumb.

This is where we really have to think about the message that we want to communicate with this pie chart. Do we really want to show all of the programming languages, or do we want to only focus on a few of them? In this case, we decide that we really only care about Java, PHP, and Python, and collapse the other categories into an “Other” column.

The correct way to use pie charts

Now we have a very clear message with our pie chart: Java, PHP, and Python together represent nearly 1/2 of all Google searches for programming languages, and Java represents roughly 1/4 of all searches alone.

Note that we shouldn’t try to use the pie chart to compare between Java, PHP, or Python: Pie slices are notoriously difficult to compare directly , especially if we ask our uncle who always takes the bigger slice of pumpkin pie during Thanksgiving dinner. If we want to compare the proportions, then we should use a bar chart instead.

Always start your pie charts at the top

One final note: Our readers will typically start reading our pie charts from the top of the circle — the 0‎° mark. We should never violate our readers’ expectations by starting the parts at any other section of the circle, even if it makes the pie chart look like Pac-Man.

The correct way to use pie charts

Fortunately, most data visualization software starts pie charts at the 0‎° mark. But in case you find software that doesn’t: you’ve been warned!

Recap

Now that we’ve walked through a few visualization exercises, let’s recap what we’ve learned about pie charts.

  1. The parts must sum to a meaningful whole. Always ask yourself what the parts add up to, and if that makes sense for what you’re trying to convey.
  2. Collapse your categories down to three or fewer. Pie charts cannot communicate multiple proportions, so stick to their strengths and keep your pie charts simple.
  3. Always start your pie charts at the top. We naturally start reading pie charts at the top (the 0‎° mark). Don’t violate your reader’s expectations.

Pie charts are useful for representing a simple proportion of a whole, and can easily be interpreted by expert and novice alike. Keep these tips in mind the next time you need to communicate a simple proportion to a general audience.

If you liked what you saw in this post and want to learn more about data visualization, come take a look at my Python data visualization video course that I made in collaboration with O’Reilly. In just one hour, I will cover these topics and much more, which will provide you with a strong starting point for your career in data visualization.

转载本站任何文章请注明:转载至神刀安全网,谢谢神刀安全网 » The correct way to use pie charts

分享到:更多 ()

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
分享按钮