// However, this will steal space from a subplot layout:
fig, axs = plt.subplots(2, 2, constrained_layout=True)
for ax in axs.flatten()[:-1]:
ax.plot(np.arange(10))
axs[1, 1].plot(np.arange(10), label="This is a plot")
axs[1, 1].legend(loc="center left", bbox_to_anchor=(0.8, 0.5))
After Change
leg.set_in_layout(True)
// we don"t want the layout to change at this point.
fig.set_constrained_layout(False)
fig.savefig("CL01.png", bbox_inches="tight", dpi=100)
//////////////////////////////////////////////////////////////////////////////////////////
// The saved file looks like:
//