matplotlib percent label position in pie chart

You can control the distance of the percents and labels from the center of the pie using pctdistance= and labeldistance=, try this on your code:

plt.pie(sizes, labels=labels, autopct="%1.0f%%", pctdistance=1.1, labeldistance=1.2)

You can also set a radius of the pie using radius= (by default is 1)

Leave a Comment

tech