饼图简单绘制

import matplotlib.pyplot as lt
#显示中文
lt.rcParams['font.sans-serif']=['SimHei']
lt.rcParams['axes.unicode_minus']=False
labels='Frogs','Hogs','Dogs','Logs'#图标签
sizes=[10,20,30,40]#图比例
colors=['yellowgreen','gold','lightskyblue','lightcoral']#饼图分布颜色
explode=(0,0.1,0,0)#突出显示数值
lt.pie(sizes,explode=explode,labels=labels,colors=colors,autopct='%1.1f%%',shadow=True,startangle=90)
lt.axis('equal')#显示为圆
lt.show()

猜你喜欢

转载自www.cnblogs.com/chunqing/p/9267383.html