What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
Make one Matplotlib Axes for each dataset, then call ax.pie() on each Axes. plt.subplots() creates the grid; matching slice order and colors across panels makes the charts easier to compare.
Make multiple pie charts in one figure
This example creates a 2 × 2 grid, with one pie chart for each group:
import matplotlib.pyplot as plt
labels = ["A", "B", "C"]
data_by_group = {
"Group 1": [40, 35, 25],
"Group 2": [30, 45, 25],
"Group 3": [25, 25, 50],
"Group 4": [20, 30, 50],
}
fig, axs = plt.subplots(2, 2, figsize=(9, 7), layout="constrained")
for ax, (title, values) in zip(axs.flat, data_by_group.items()):
ax.pie(values, labels=labels, autopct="%1.0f%%", startangle=90)
ax.set_title(title)
plt.show()
Each call to ax.pie(values, ...) draws on a separate Axes. The shared labels list names the slices, autopct formats the percentage text, and startangle rotates the pie. The panel title identifies which dataset is shown.
Choose a grid that fits your groups
plt.subplots(rows, columns) returns a figure and its Axes. For a regular grid, axs.flat lets the loop visit each Axes in order, while zip pairs it with a title and dataset. Set the row and column counts to suit the number of groups, and provide one dataset per panel.
#1 Best Overall
The example uses layout="constrained" to help fit the panels and their labels into the figure. Increase figsize if titles, category names, or percentages feel cramped. Matplotlib’s subplot gallery documents the figure-and-Axes grid workflow.
Keep categories comparable across charts
If the panels are meant to compare the same categories, keep the category order consistent and assign each category the same color in every pie. Otherwise, a category could appear to change meaning between panels. Pass an explicit color list through the colors argument:
colors = ["#4C78A8", "#F58518", "#54A24B"]
ax.pie(values, labels=labels, colors=colors)
Use the same labels and colors for every Axes when the underlying categories match.
Adjust labels and pie appearance
Matplotlib’s pie method supports options for slice names, percentages, placement, and appearance. Common choices include:
Recommended Free Tools
Rank #3
labelssupplies category names.autopctadds formatted percentages, such as"%1.0f%%".startanglerotates the slices;radiuschanges pie size.labeldistanceandpctdistancecontrol the positions of category labels and percentage text relative to the pie radius. Values greater than 1 place text beyond the edge.colors,hatch,explode, andshadowprovide additional styling options.
For small panels or long category names, labels can collide. Enlarge the figure, or omit wedge labels and identify categories in a shared legend; percentages can remain inside the wedges if they are useful. Matplotlib’s pie chart example demonstrates these formatting options and notes that equal aspect—or a square figure or Axes—helps keep a pie circular. The Axes.pie API also documents the method and its parameters.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Check your Matplotlib version if using the return value
The code above does not use the value returned by ax.pie(), so it avoids depending on its return type. Matplotlib’s stable gallery identifies its documentation version as 3.11.2, and the current API search information indicates that the return value changed in version 3.11. If your code needs to unpack or inspect that return value, check the API documentation for the version installed in your environment.
Quick Recap
Best Value
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.




