Matplotlib constrained_layout vs. tight_layout

If Matplotlib “suptitle” clashes with other figure text when using tight_layout() try constrained_layout, which can work better than tight_layout(). To make figures with subplots and suptitle work better, use figure(constrained_layout=True):

from matplotlib.figure import Figure

fg = Figure(constrained_layout=True)
ax = fg.subplots(3, 1)

for i in range(3):

fg.suptitle('lots of lines')


This plot is often superior to fg.tight_layout()