我正在使用matplotlib绘制一些饼图,但有些图表上的百分比标签重叠在一起,看起来很杂乱。有没有办法改变文字位置,使其全部可读?
下面是我得到的一个示例 - 类别“Others”和“ALD2_OH”重叠在一起,无法阅读。
我的绘图代码如下:
下面是我得到的一个示例 - 类别“Others”和“ALD2_OH”重叠在一起,无法阅读。
我的绘图代码如下:
matplotlib.rcParams.update({'font.size': 18})
plt.figure(figsize=(11,11))
labels = ['ALD2 + OH','PAN + $therm$','ALD2 + NO$_3$','ATOOH + $hv$',
'Others',]
colours = ['BlueViolet','DarkMagenta','DarkOrchid','DarkViolet','Purple'
]
patches, texts,autotexts = plt.pie(main_producers, labels=labels, colors = colours,
autopct='%1.1f%%', startangle = 90)
plt.title('Contribution to MCO$_3$ yeild')
希望有人能够帮忙!
谢谢。