成品
首先上最终成品
代码
图1的展示
# 重新设置字体大小
proptease = fm.FontProperties()
proptease.set_size('xx-large')
# font size include: ‘xx-small’,x-small’,'small’,'medium’,‘ large’,‘x-large’,‘xx-large’ or number, e.g. '12'
labels = 'internal operator user', 'external user', 'external quick view collection user', 'external stripping collaborator', 'internal robot user'
sizes = [62, 4048, 88, 36, 168]
colors = cm.GnBu(np.arange(len(sizes)) / len(sizes)) # colormaps: Paired, autumn, rainbow, gray,spring,Darks
explode = (0, 0.2, 0, 0, 0) # only "explode" the 2nd slice (i.e. 'Hogs')
fig, axes = plt.subplots(figsize=(10, 4), ncols=3) # 设置绘图区域大小
ax1, ax2, ax3 = axes.ravel()
plt.subplot(1, 3, 1)
# plt.pie(sizes, explode=explode, labels=labels, colors=colors,
# autopct='%1.1f%%', shadow=False, startangle=90)
patches, texts = ax1.pie(sizes, explode=explode, colors=colors,
shadow=False, startangle=90)
# plt.setp(autotexts, fontproperties=proptease)
# Set aspect ratio to be equal so that pie is drawn as a circle.
plt.axis('equal')
ax3.axis('off')
ax3.legend(patches, labels, loc='center left')
plt.tight_layout()
sizes = [60, 4402, 92, 172, 0]