python数据可视化学习-饼状图 - Go语言中文社区

python数据可视化学习-饼状图


 

import numpy as np
import matplotlib.pyplot as plt
labels ='A','B','C','D'
fraces = [15,30,45,10]
plt.pie(x=fraces,labels= labels)
plt.show()

 

椭圆变标准圆  plt.axes(aspect=1)

 

import numpy as np
import matplotlib.pyplot as plt
labels ='A','B','C','D'
fraces = [15,30,45,10]
plt.axes(aspect=1)
plt.pie(x=fraces,labels= labels)
plt.show()

在图上显示所占份额autopct='%0f%%'

import numpy as np
import matplotlib.pyplot as plt
labels ='A','B','C','D'
fraces = [15,30,45,10]
plt.axes(aspect=1)
plt.pie(x=fraces,labels= labels,autopct='%0f%%')
plt.show()

突出重点,分离某一块explode= explode

import numpy as np
import matplotlib.pyplot as plt
labels ='A','B','C','D'
fraces = [15,30,45,10]
explode = [0,0.5,0,0]
plt.axes(aspect=1)
plt.pie(x=fraces,labels= labels,autopct='%0f%%',explode= explode)
plt.show()

实现立体感 有阴影 shadow=True

import numpy as np
import matplotlib.pyplot as plt
labels ='A','B','C','D'
fraces = [15,30,45,10]
explode = [0,0.1,0,0]
plt.axes(aspect=1)
plt.pie(x=fraces,labels= labels,autopct='%0f%%',explode= explode,shadow=True)
plt.show()

版权声明:本文来源CSDN,感谢博主原创文章,遵循 CC 4.0 by-sa 版权协议,转载请附上原文出处链接和本声明。
原文链接:https://blog.csdn.net/qq_31390999/article/details/82828898
站方申明:本站部分内容来自社区用户分享,若涉及侵权,请联系站方删除。
  • 发表于 2020-03-08 16:31:00
  • 阅读 ( 1078 )
  • 分类:

0 条评论

请先 登录 后评论

官方社群

GO教程

猜你喜欢