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()

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

 

椭圆变标准圆  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()

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

在图上显示所占份额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()

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

实现立体感 有阴影 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()

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

相关文章:

  • 2021-12-29
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-06-16
  • 2022-12-23
  • 2022-01-07
猜你喜欢
  • 2022-12-23
  • 2021-10-04
  • 2022-02-21
  • 2021-12-19
  • 2022-12-23
  • 2021-03-31
  • 2021-12-01
相关资源
相似解决方案