首页 > 编程语言 > 详细

python matplotlib 绘图

时间:2016-07-23 23:04:51      阅读:377      评论:0      收藏:0      [点我收藏+]

饼图

import matplotlib.pyplot as plt

# The slices will be ordered and plotted counter-clockwise.
labels = Frogs, Hogs, Dogs, Logs
sizes = [15, 30, 45, 10]
colors = [yellowgreen, gold, lightskyblue, lightcoral]
explode = (0, 0.1, 0, 0)  # only "explode" the 2nd slice (i.e. ‘Hogs‘)

plt.pie(sizes, explode=explode, labels=labels, colors=colors,
        autopct=%1.1f%%, shadow=True, startangle=90)

# Set aspect ratio to be equal so that pie is drawn as a circle.
plt.axis(equal)


plt.savefig(D:\\pie.png)
plt.show()

 结果

技术分享

python matplotlib 绘图

原文:http://www.cnblogs.com/kaituorensheng/p/5668636.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!