亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

python - matplotlib error making a pie chart
過去多啦不再A夢
過去多啦不再A夢 2017-06-12 09:23:57
0
1
1094
def plot_graph():
    lables = '男生比例','女生比例','其他'
    sizes = get_friends_rate()
    plt.pie(sizes, lables, autopct='%.3f%%', shadow=False, startangle=90)
    plt.axis('equal')
    plt.show()
plot_graph()

def get_friends_rate() returns
return [float(male)/total 100, float(female)/total 100, float(other)/total * 100]
appears when running mistake:

過去多啦不再A夢
過去多啦不再A夢

reply all(1)
世界只因有你

The following source code is used:

>>> from matplotlib import pyplot as plt
>>> sizes = 30,20,50
>>> lables = u'男生比例',u'女生比例',u'其他'
>>> plt.pie(sizes, labels=lables,autopct='%.3f%%', shadow=False, startangle=90)
>>> plt.axis('equal')
>>> plt.show()

Just pass in the labels using the labels parameter. Python2.7 is used to write it here. Since it is in Chinese, there will be a problem that it cannot be displayed.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template