I was trying to create a pie chart in matplotlib and would like to put the labels within wedges. I used the following code to do it:
import matplotlib.pyplot as plt
fig = plt.figure(1, figsize=(8,8), dpi=60)
ax=fig.add_axes([0.1,0.1,0.8,0.8])
labels = ['label0','label1','label2','label3','label4','label5','label6','label7','label8',\
'label0','label1','label2','label3','label4','label5','label6','label7','label8']
colors = list('w' for _ in range(18))
fracs=list(20 for _ in range(18))
ax.pie(fracs, labels=labels, colors = colors, startangle=10,labeldistance=0.8)
plt.show()
It seems that the labels are not properly aligned within wedges as shown in the image below. Is there any way to modify(or rotate) the labels so that they can be shown properly inside the wedges?
Thank you!