python可视化总结(官方教程)——2饼图
作者:互联网
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()
标签:autopct,教程,ax1,python,labels,pie,explode,plt,可视化 来源: https://blog.csdn.net/weixin_42377217/article/details/114752079