python plt.savefig, subplots : 为什么上下图重叠 table

python plt.savefig, subplots : why the upper-bottom figure overlapped with bottom-upper table

我做了一个图&table,下面的图window就可以了,加上constrained_layout=True后:

但是,当我将图形保存到图片时,table 和图形重叠 plt.savefit("path+fig.png", bbox_index='tight)。希望有大佬指教,谢谢!

我已经学会了如何避免这种情况(虽然仍然不清楚为什么) plt.tight_layout()应该在plt.savefig('path+name.jpg', bbox_inches='tight')后面,那么viewstables就不会重叠了。

  • 如果plt.tight_Layout()plt.savefig之前,我们看到的是functiong只能tight viewes排除tables (表格很可能会重叠),plt.savefig();
  • 创建的图片也是如此
  • 如果我们设置 plt.rcParams['figure.autolayout'] = True 而不是 plt.tight_layout(),那么 viewestablesfigure window 中是可以的,但是 tables 仍然重叠在 plt.savefig();
  • 创建的图片中
  • 如果我们移动 plt.savefig(),

    -- plt.tight_layout()只能缩放viewes不包括tables;

    -- plt.rcParams['figure.autolayout']=True可以在figure window.

  • 中同时缩放viewestables