Don’t Use Pie Charts in Your Data Analysis

Why You Shouldn’t Use Pie Charts and How To Replace Them.

Vinicius Porfirio Purgato
Analytics Vidhya
4 min readMar 17, 2021

--

Pie charts are one of the most popular types of visualization people use daily. However, it is also one of the worse, to say the least.

Photo by Priscilla Du Preez on Unsplash

Do not use charts named after foods.

You might be wondering “Oh my Gosh, how come the most popular chart is the worse?”.

I know, I know. Pies are indeed delicious. However, they aren’t as good when it comes to data visualization.

Before We Start

Do not forget to follow me on my GitHub and LinkedIn accounts. I love to write about Data Science and to share cool stuff with people on the internet.

Why You Shouldn’t Use Pie Charts

Usually, pie charts are used to tell stories about how relevant a part is concerning the other. Basically, how big part A is in relation to parts B, C and others. However, the big trouble with pie charts is that to understand them, we have to compare areas (or angles), and that is a task humans are terrible at. In general, we overestimate the obtuse angles and underestimate the acute ones.

Most of the time, bar plots are the best option to replace pie charts.

Here’s an example of a pie chart, of the ten countries with the highest number of deaths by Covid-19:

Plot by Author

You can’t really tell how much bigger one is from the other. Of course, you can find out (or try) by doing some math and looking at the value of each slice. Yet, general-purpose charts are supposed to be intuitive, you should not have difficulties understanding them.

Now let’s plot a bar graph from the same data:

Plot by Author

Much better, right? I actually used this plot in my Covid-19 Data Analysis, check it out if you haven’t yet.

Bar charts are a better option to compare data relations. That is because they let us compare different objects by their one-dimensional length. And humans are way better at comparing objects along one dimension than along two, making the bar comparison way easier than the areas of pie slices. It’s just simpler.

In general, pie charts are indeed prettier than other graphs. However, they don’t do their job as well.

If you want to learn more about data visualization I highly encourage you to read Storytelling With Data by Cole Nussbaumer Knaflic.

If you want to get more deep into why not to use pie charts, I would also recommend reading Save The Pies for Dessert by Stephen Few. Along with colleagues, he wrote many reasons why and how pie charts may mislead you to wrong conclusions. Here’s a quotation from the paper:

This information is much easier to read when presented in a table than it was when awkwardly arranged around the periphery of the pie. So why use a graph at all? Why show a picture of the data if the picture can’t be decoded and doesn’t present the information more meaningfully? The answer is: You shouldn’t. Graphs are useful when a picture of the data makes meaningful relationships visible (patterns, trends, and exceptions) that could not be easily discerned from a table of the same data.

There also many other researchers arguing that pie charts are terrible. Even though William Cleveland wasn’t the first to criticize pie charts, in 1984 he wrote a scientific paper concluding that humans had 1.96 times more accurate conclusions when using bar charts instead of pie charts. That is because comparing lengths is easier than angles.

When to Use Pie Charts

To be honest, I did some research on this and the results aren’t pleasant for the fans of pie charts (do they even exist?).

Most data scientists would consider using pie charts only when your visualization has two possible variables, like yes or no. Yet, you would still have to add numeric labels, if you don’t, the information won’t be clear.

Personally, even in this case, I would consider using bar charts. For me, it’s just a matter of good practices, like commenting on your code.

How To Plot Pie Charts

Photo by Myriam Jessier on Unsplash

I know, your customer/boss might not care whether pie charts are confusing or not, they may want it in the reports. Since they are paying you, you have to deliver it.

Therefore, here are some good articles on how to make plot good pie charts in Python with Matplotib.

Citation

Neves, Fábio. “Stop Using Those Ugly Pie Charts!” Medium, Medium, 11 Oct. 2018, medium.com/@fneves/stop-using-those-ugly-pie-charts-962ac70beb41

Hamberg, Sven. Why You Shouldn’t Use Pie Charts — Tips for Better Data Visualization, blog.funnel.io/why-we-dont-use-pie-charts-and-some-tips-on-better-data-visualizations

Few, Stephen. “Save the Pies for Dessert.” Perceptual Edge, Aug. 2007, pp. 1–14,doi:www.perceptualedge.com/articles/visual_business_intelligence/save_the_pies_for_dessert.pdf

--

--

Vinicius Porfirio Purgato
Analytics Vidhya

Computer Science student in love with teaching and learning Data Science. Python lover and R bully :)