A pie chart is a circle divided into sectors, with each sector’s angular size proportional to the value it represents. Pie charts are designed for showing how a whole is composed — the relative size of each part as a fraction of the total. They’re conventionally drawn with percentage labels, and the percentages should sum to 100%.
Image: Simple pie chart, CC BY-SA 3.0
Pie charts have a reputation for being misused, and the reputation is partly deserved. The eye is bad at comparing angles. Two slices of similar size — 17% and 22% — are hard to rank visually; the same two values in a Bar chart are unambiguous. Studies of perceptual accuracy consistently rank position-along-axis (which bar charts use) higher than angle (which pie charts use), and color encoding even lower.
So when is a pie chart appropriate?
- Few categories — three or four slices, where the message is this part is big, that part is small. With seven or eight slices it gets crowded fast.
- Whole-composition emphasis — the explicit message is these parts together make 100% of the thing. The circular shape carries that meaning visually.
- The numbers matter less than the rough proportions — pie charts read well when the precise values are labelled and the chart is doing the work of showing part-of-whole rather than supporting close numeric comparison.
If the message is comparing magnitudes precisely, or if there are many small slices, a Bar chart or Stacked bar chart is almost always clearer. The data-visualization literature has been complaining about pie charts for decades, but they remain popular in executive presentations because the whole = sum of parts visual metaphor is intuitively strong.
In Matplotlib, ax.pie(values, labels=labels, autopct='%1.1f%%') draws a pie chart with percentage annotations on each slice.