What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
Create a nested pie chart in Matplotlib by calling Axes.pie() twice: use group totals for the outer ring and child values for the inner ring. Give each call labels in the same order as its data, and set wedgeprops={"width": ...} to turn the pie into a ring.
Build the nested chart with two pie calls
This pattern follows Matplotlib’s documented nested-chart approach: the outer ring shows each group’s total, while the inner ring shows its component values. The example uses three groups with two children each. It is an implementation pattern, not a claim that the code has been run or tested.
import matplotlib.pyplot as plt
import numpy as np
vals = np.array([[60., 32.], [37., 40.], [29., 10.]])
group_labels = ["Group A", "Group B", "Group C"]
child_labels = ["A1", "A2", "B1", "B2", "C1", "C2"]
fig, ax = plt.subplots()
ring_width = 0.3
ax.pie(
vals.sum(axis=1),
radius=1,
labels=group_labels,
labeldistance=1.08,
wedgeprops={"width": ring_width, "edgecolor": "white"},
)
ax.pie(
vals.flatten(),
radius=1 - ring_width,
labels=child_labels,
labeldistance=1.08,
wedgeprops={"width": ring_width, "edgecolor": "white"},
)
ax.set(aspect="equal", title="Nested pie chart")
plt.show()
The outer call sums each row with vals.sum(axis=1); the inner call flattens the child values into the sequence expected by Axes.pie(). Keep group_labels aligned with the row totals and child_labels aligned with the flattened values. Matplotlib documents labels as the way to supply slice labels. Matplotlib’s nested pie chart example and pie chart features example show the underlying patterns.
Add percentages and place text
Add autopct="%.1f%%" to a pie call to display percentages formatted to one decimal place. Matplotlib calculates those percentages from the values passed to that specific call. Thus, percentages on the outer ring are based on group totals, while percentages on the inner ring are based on the child values supplied to the inner call—not automatically on the overall total.
Quick wins for a faster PC:
Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →Clear out junk files and repair common Windows errorsFree Scan →Scan for outdated or missing drivers - takes under a minuteDriver Scan →#1 Best Overall
Use labeldistance to adjust slice-label placement and pctdistance to adjust the placement of the percentage text generated by autopct. Both are expressed as ratios of the pie radius; values greater than 1 position the text outside the circle. If inner percentages need to represent each child’s share of the full dataset, calculate those values yourself and place them with custom text or annotations rather than relying on the default autopct for that ring. These options are documented in Matplotlib’s pie chart features example.
Choose a labeling method that stays readable
Direct labels are convenient when there is enough room around each wedge. With many or narrow slices, labels can collide or become hard to associate with the correct segment. In that case, use a legend or annotations with connector lines instead of forcing every label around the chart.
Rank #2
- Direct labels: pass a label list to each
pie()call; match its order to that call’s data. - Percentages: add
autopctwhen percentages clarify the chart and fit within or around the wedges. - Legend: use wedge patches as legend handles when a separate key is clearer. Matplotlib’s donut chart example demonstrates this approach.
- Annotations: calculate wedge midpoint angles to position outside text and connector lines when precise placement is needed; the same official donut example illustrates the technique.
When to use a different chart construction
For a conventional nested donut, two Axes.pie() calls are the simplest documented route. If you need finer control over the geometry, Matplotlib’s nested-chart example also presents a polar-coordinate bar plot as an alternative; it represents sectors with bars and allows more control over their design. See the nested pie chart example for that alternative.
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.




