Pie charts and bar charts are two of the most common charts used for visualizing data. This tutorial will explain what they are and when to use them.
What are Bar Charts and Pie Charts?
A bar chart, or bar graph, is a very common two-dimensional data visualization made up of rectangular bars, each corresponding to a category and whose length represents the value of that category. The bars can be either vertical (sometimes called a column graph) or horizontal. For example, this figure shows a bar chart of the results of the 2000 US presidential election. Each bar represents a candidate (the category) and the height of the bar represents how many votes that candidate received (the value).
Here are the same election results, but presented with a horizontal bar graph.
A pie chart is also a very common two-dimensional data visualization where categories and their values are represented. But in this case the values are proportions of a total and they are visualized as slices of a circle (a pie). Here are the same results on the 2000 US presidential election represented as a pie chart.
Note that instead of showing the count of votes as the value of interest, as in the bar charts, the pie chart focuses on the percent of the total votes.
Why Do Some Call Pie Charts Evil?
In the world of data visualizations, pie charts get a lot of hate. The primary goal of data visualizations is to clearly and concisely communicate information. The main criticism against pie charts is that it is very difficult for the human eye to estimate the magnitude of angles, thus making visualization not very clear. To compensate, pie charts require more labels to get the measurements across, making them not very concise. In short, often they defeat the main purpose of a data visualization.
You can see this criticism with the previous example on the 2000 US presidential election, which was a famously close race.
The pie chart makes it rather difficult to tell who won the election without referencing the legend or adding data labels to each of the slices, whereas in the bar chart, it is immediately evident who won the popular vote.
So Should You Ever Use a Pie Chart?
Yes, despite all the criticisms of pie charts, they can still be a great tool when used properly.
Let’s consider these visualizations of the sales from a fictitious fruit stand.
From the bar chart, it’s easy to see the relative sales values of each fruit. From the pie chart, you have you make use of the legend on the right to see whether many of the smaller slices are equivalent.
But what if you wanted to know if apples made up at least half of your sales? With the bar chart, you’d have to do some mental math summing all the non-apple sales, and even then you might not know for sure. But with the pie chart it’s immediately obvious, even without looking at the value in the legend, that apples do in fact make up more than half of sales.
So which is the best chart to use for this data? If your goal for the visualization is to convey the sales amount of each product, the bar chart is the better selection. But if the point of your visualization isn’t to know the precise value of each of the products, but instead to bring home the point that apples are more than half of your business, then the pie chart is a more powerful visualization. You can even drop the legend and just label the single point of focus to make point clearly and concisely.
When to Use a Bar Chart Vs. a Pie Chart
Most data visualization tools make it very easy to plot your data as either a bar chart or a pie chart. So which should you choose? As with any data visualization, you have to be thoughtful about what its goal is.
Because of the pitfalls of pie charts, bar charts tend to be the better choice. However, as we saw in the previous section, there are times when the pie chart is actually the better, more powerful visualization. Additionally, there are many instances where it’s easy for the human eye to tell the slice values approximately enough for the purpose of the visualization. In that case the choice between the bar chart and the pie chart is purely a matter of preference.
As a rule of thumb:
- Use either a bar chart or a pie chart when comparing parts of a whole, the categories are few (up to four), and it’s easy for the human eye to estimate their value when presented as slices (as when the values are close to 25%, 50% or 75%)
- Use a pie chart when there is a specific and clear point related to the share of the total that you are trying to get across and the individual values of each slice is not important
- Use a bar chart otherwise
Bar charts and pie charts are very common data visualization tools, but it is important to use them correctly to ensure you convey clear and concise information.