使用奇数个图表时,将最后一个matplotlib子图居中

2024-06-16 13:04:57 发布

您现在位置:Python中文网/ 问答频道 /正文

如果我有5个图表,如果我做了一个3x2子图,我如何将最后一个(第5个)图表居中?在

这是我当前的代码:

plt.figure(1)

plt.subplot(321)
firstperiod.megaball.plot(kind='hist', bins = 25)

plt.subplot(322)
secondperiod.megaball.plot(kind='hist', bins = 36)

plt.subplot(323)
thirdperiod.megaball.plot(kind='hist', bins = 52)

plt.subplot(324)
fourthperiod.megaball.plot(kind='hist', bins = 46)

plt.subplot(325)
fifthperiod.megaball.plot(kind='hist', bins = 15)

还想在图表之间放更多的空白,这样轴的值就不会变得拥挤和重叠。。还有其他选择吗?在


Tags: 代码plot图表plthistfigurekindbins