matplotlib 减少subplot空白

调整前:

...
fig = Figure(figsize=(width, height))
self.ax1 = fig.add_subplot(311)
self.ax2 = fig.add_subplot(312)
self.ax3 = fig.add_subplot(313)
...

在这里插入图片描述

调整后:

...
fig = Figure(figsize=(width, height))
self.ax1 = fig.add_subplot(311)
self.ax2 = fig.add_subplot(312)
self.ax3 = fig.add_subplot(313)
fig.set_tight_layout(True)# fig.tight_layout()会出现警告
...

在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/MacwinWin/article/details/86240171