python可视化总结(官方教程)——2饼图

python可视化总结(官方教程)——2饼图,第1张

概述importmatplotlib.pyplotasplt#Piechart,wherethesliceswillbeorderedandplottedcounter-clockwise:labels='Frogs','Hogs','Dogs','Logs'sizes=[15,30,45,10]#explode为偏移explode=(0,0.1,0,0)#
import matplotlib.pyplot as plt# PIE chart, where the slices will be ordered and plotted counter-clockwise:labels = 'Frogs', 'Hogs', 'Dogs', 'Logs'sizes = [15, 30, 45, 10]#explode为偏移explode = (0, 0.1, 0, 0)  # only "explode" the 2nd slice (i.e. 'Hogs')fig1, ax1 = plt.subplots()#autopct 为图形上展示的数值比例ax1.pIE(sizes, explode=explode, labels=labels, autopct='%1.1f%%',        shadow=True, startangle=90)ax1.axis('equal')  # Equal aspect ratio ensures that pIE is drawn as a circle.ax1.legend()plt.show()

总结

以上是内存溢出为你收集整理的python可视化总结(官方教程)——2饼图全部内容,希望文章能够帮你解决python可视化总结(官方教程)——2饼图所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/langs/1188715.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-06-03
下一篇 2022-06-03

发表评论

登录后才能评论

评论列表(0条)

保存