用Python的matplotlib画饼图:
代码:
#饼图:超市主要商品本月销售量
import matplotlib.pyplot as plt
plt.title('Sales of major commodities in supermarkets for this month')
labels = 'Noodles', 'Milk', 'Biscuits', 'Chocolates'
sizes = [15, 30, 45, 10]
colors = ['lawngreen', 'gold', 'red', 'deeppink']
explode = (0.1, 0, 0, 0)
plt.pie(sizes, explode=explode, labels=labels, colors=colors, autopct='%1.1f%%', shadow=True, startangle=90)
plt.axis('equal')
plt.show()
效果图: