matplotlib.axes.Axes.pie_label
- Axes.pie_label(container, /, labels, *, distance=0.6, textprops=None, rotate=False, alignment='auto')
Label a pie chart.
Label a pie chart.
Added in version 3.11.
Adds labels to wedges in the given PieContainer.
PieContainerContainer with all the wedges, likely returned from pie.
A sequence of strings providing the labels for each wedge, or a format
string with absval and/or frac placeholders. For example, to label
each wedge with its value and the percentage in brackets:
labels="{absval:d} ({frac:.0%})"
The radial position of the labels, relative to the pie radius. Values > 1 are outside the wedge and values < 1 are inside the wedge.
Dict of arguments to pass to the Text objects.
Rotate each label to the angle of the corresponding slice if true.
Controls the horizontal alignment of the text objects relative to their nominal position.
'center': The labels are centered on their points.
'outer': Labels are aligned away from the center of the pie, i.e., labels on the left side of the pie are right-aligned and labels on the right side are left-aligned.
'auto': Translates to 'outer' if distance > 1 (so that the labels do not overlap the wedges) and 'center' if distance < 1.
If rotate is True, the vertical alignment is also affected in an analogous way.
'center': The labels are centered on their points.
'outer': Labels are aligned away from the center of the pie, i.e., labels on the top half of the pie are bottom-aligned and labels on the bottom half are top-aligned.
A list of the label Text instances.
matplotlib.axes.Axes.pie_label