回答此问题可获得 20 贡献值,回答如果被采纳可获得 50 分。
<p>我已经创建了一个非常好的饼图,但它仍然不是完美的。
我的代码是:</p>
<pre><code>labels_occurancy = ['composition', 'process', 'pathology', 'other_meds',
'disposal', 'animal', 'device', 'cultivation', 'food',
'tests', 'compliance']
size_occurancy = [199, 179, 63, 128, 33, 8, 44, 24, 37, 31, 4]
explode = (0.008, 0.008, 0.008,0.008,0.008,0.008,0.008,0.008,0.008,0.008,0.008)
textprops = {"fontsize":15}
plt.pie(size_occurancy, labels=labels_occurancy, explode=explode,
autopct='%1.1f%%', pctdistance = 0.8, textprops =textprops,
radius = 0.5)
plt.title('Classification in %', fontdict = {'fontsize':20})
plt.show()
</code></pre>
<p>下一个问题是我的图表。按照原来的尺寸,整个屏幕上的馅饼都很大。这就是为什么我决定使用<code>radius</code>。但随着减少,我的标签变得不清晰,可读性降低(即使是为了增加标签的大小)。最大的问题是,随着半径的减小,图表下方和下方仍有大量空间。smb能给我一些解释或建议吗</p>