饼图

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  绘图

相关文章:

  • 2022-12-23
  • 2021-09-08
  • 2021-10-01
  • 2022-01-04
  • 2022-12-23
  • 2021-10-31
  • 2022-12-23
猜你喜欢
  • 2021-05-13
  • 2021-10-09
  • 2021-10-30
  • 2021-04-05
  • 2022-02-21
  • 2021-08-20
  • 2021-08-24
相关资源
相似解决方案