Pie Charts#
A pie chart is a circular graphic, divided into slices to illustrate numerical portion. The arc length of each slice (and thus its central angle and area) is proportional to the quantity it represents.
Data visualization and information perception research suggests that, while useful in some cases, making visual comparisons within a pie chart or across pie charts is challenging. This research recommends pie charts be replaced by other types of plots (scatter plots, density plots, bar charts, box plots, etc).
To learn more:
Leland Wilkinson, The Grammar of Graphics (Springer, 2005). Link to electronic access through Hesburgh Libraries.
Edward Tufte, The Visual Display of Quantitative Information (Graphics Press, 1983). Link to catalog entry for Hesburgh Library physical copy.
Stephen Few, “Save the Pies for Dessert” Perceptual Edge (21 August 2007)
Steve Fenton, “Pie Charts are Bad” personal blog (17 April 2009)
Dipanjan Sarkar, “A Comprehensive Guide to the Grammar of Graphics for Effective Visualization of Multi-dimensional Data” Towards Data Science (12 September 2018)
But, as Google’s design lead Manuel Lima has noted, humans love pie charts. So we’ll cover them.
Manuel Lima, “Why humans love pie charts: An historical and evolutionary perspective” Noteworthy: The Journal Blog (23 July 2018)
%matplotlib inline
import matplotlib.pyplot as plt, numpy as np # import statements
labels = 'Frogs', 'Hogs', 'Dogs', 'Logs' # slice labels
sizes = [15, 30, 45, 10] # slice sizes
fig, ax = plt.subplots() # create figure
ax.pie(sizes, labels=labels, autopct='%1.1f%%') # pie chart with custom labels
ax.axis('equal') # set equal aspect ratio to ensure pie is a circle
plt.show() # show plot
Additional Resources#
For more on pie charts: