小编Pic*_*olo的帖子

如何在python中的饼图上设置标签大小

我希望python中的饼图上有小尺寸的标签,以提高可视性,这里是代码

import matplotlib.pyplot as plt

frac=[1.40 , 10.86 , 19.31 , 4.02 , 1.43 , 2.66 , 4.70 , 0.70 , 0.13 , 1.48, 32.96 , 1.11 , 13.30 , 5.86]
labels=['HO0900344', 'HO0900331', 'HO0900332', 'HO0900354', 
'HO0900358', 'HO0900374', 'HO0900372', 'HO0900373', 
'HO0900371', 'HO0900370', 'HO0900369', 'HO0900356', 
'HO0900353', 'HO0900343']

fig = plt.figure(1, figsize=(6,6))
ax = fig.add_subplot(111)
ax.axis('equal')
colors=('b', 'g', 'r', 'c', 'm', 'y', 'burlywood', 'w')
ax.pie(frac,colors=colors ,labels=labels, autopct='%1.1f%%')
plt.show()
Run Code Online (Sandbox Code Playgroud)

谢谢和欢呼

python matplotlib labels pie-chart

33
推荐指数
2
解决办法
3万
查看次数

标签 统计

labels ×1

matplotlib ×1

pie-chart ×1

python ×1