import matplotlib.pyplot as plt
import numpy as np
plt.rcParams['font.sans-serif']=['SimHei']
y=np.array([29665,3135.4,4292.4,5240.4,5543.4,5633.8,6414.5,9308.1,10353])
title=np.array(['童装','奶粉辅食','孕妈专区','洗护喂养','宝宝尿裤','春夏新品','童车童床','玩具文娱','童鞋'])
plt.figure(dpi=100,figsize=(10,8))
plt.pie(y,autopct='%.2f%%')
plt.legend(title,loc='upper right',ncol=2)
plt.title('拼多多平台子类目的销售额')
plt.table(cellText=[y],colWidths=[0.1]*9,rowLabels=['单位:亿元'],colLabels=title,loc='lower center')
plt.show()
import matplotlib.pyplot as plt
plt.rcParams['font.sans-serif']=['SimHei']
plt.rcParams['axes.unicode_minus']=False
kinds=['面粉','全麦粉','酵母','苹果酱','鸡蛋','黄油','盐','白糖']
weight=[250,150,4,250,50,30,4,20]
total_weight=0
for i in weight:
total_weight+=i
batching_scale=[i/total_weight for i in weight]
plt.pie(batching_scale,autopct='%3.1f%%')
plt.legend(kinds,loc='upper right',bbox_to_anchor=[1.1,1.1])
plt.table(cellText=[weight],cellLoc='center',rowLabels=['重量(g)'],colLabels=kinds,loc='lower center')
plt.show()
import matplotlib.pyplot as plt
import numpy as np
plt.rcParams['font.sans-serif']=['SimHei']
plt.rcParams['axes.unicode_minus']=False
x=np.arange(1,8)
y=np.array([10770,16780,24440,30920,37670,48200,57270])
bar_rects=plt.bar(x,y,tick_label=["FY2013","FY2014","FY2015","FY2016","FY2017","FY2018","FY2019"],width=0.5)
def autolabel(rects):
for rect in rects:
height=rect.get_height()
plt.text(rect.get_x()+rect.get_width()/2,height+300,s='{}'.format(height),ha='center',va='bottom')
autolabel(bar_rects)
plt.ylabel('GMV(亿元)')
plt.show()