绘制整洁的饼图

时间:2019-02-28 07:34:23

标签: python matplotlib graph pie-chart

我已经绘制了一个饼图,但是它太混乱了! 我已经附上了脚本生成的示例图像!

希望有人可以帮助我绘制整洁的图形! enter image description here

我的脚本:

emotions = [neutral_avg,sadness_avg,disgust_avg,anger_avg,surprise_avg,fear_avg,happiness_avg]
labels = ['Neutral','Sadness','Disgust','Anger','Surprise','Fear','Happiness']
plt.pie(emotions,labels = labels,shadow=True, startangle=140,autopct='%1.1f%%')
date_string = time.strftime("%Y-%m-%d")
plt.savefig(date_string+'.png')

2 个答案:

答案 0 :(得分:0)

您可以尝试:ax1.axis('equal') 示例:

`fig1, ax1 = plt.subplots()
 ax1.pie(sizes, explode=explode, labels=labels, autopct='%1.1f%%',
    shadow=True, startangle=90)
ax1.axis('equal')`

答案 1 :(得分:0)

<?xml version="1.0" encoding="utf-8"?><page>
 䕶法喇嘛所居此處仲無妻室亦降神附體
</page> 

<?xml version="1.0" encoding="UTF-8"?> <page>䕶法喇嘛所居此處&#x21e01;仲無妻室亦降神附體</page> plt.pie(emotions, labels=labels, labeldistance = 1.3,pctdistance = 1.1,shadow=True, startangle=140, autopct='%1.1f%%') plt.axis('equal') 修改为所需的内容。