Pie Charts

A pie chart represents data as slices of a circle, where each slice's size is proportional to its share of the total - making it a familiar way to visualize how a whole is divided into parts.

When to Use a Pie Chart

Pie charts work best for showing simple proportions with a small number of categories (ideally 5 or fewer) that add up to a meaningful whole - like market share split between a handful of competitors.

Plotting in Python

import matplotlib.pyplot as plt

labels = ["Product A", "Product B", "Product C", "Product D"]
shares = [40, 25, 20, 15]

plt.pie(shares, labels=labels, autopct="%1.1f%%", startangle=90)
plt.title("Market Share")
plt.show()

Why Pie Charts Are Often Criticized

The human eye is generally better at comparing the length of bars than the angle or area of pie slices, especially when slices are similar in size - this makes it harder to accurately compare values in a pie chart compared to a simple bar chart.

Better Alternatives

When there are more than a handful of categories, or when precise comparison matters, a bar chart usually communicates the same information more clearly than a pie chart.

Many data visualization experts recommend avoiding pie charts altogether in favor of bar charts, reserving pie charts only for very simple, high-level proportion summaries with very few categories.

Coming Up Next

To understand the spread and outliers within a distribution at a glance, the next chart type to learn is the Box Plot.

Ready to Master Data Science?

Join Uncodemy's Data Science Course and build real, job-ready skills with expert mentors.

Explore Course