Closed
Description
I want to add a title to a matplotlib figure. Using the newer constrained_layout
the title is nicely aligned with the axis.
Unfortunately under certain circumstances the layout still overlaps as shown in the following examples in the Jupyter notebook (with different backends):
%matplotlib notebook
import numpy as np
from matplotlib import pyplot as plt
# example with low height
fig, axes = plt.subplots(nrows=2, ncols=2, figsize=(6, 3), constrained_layout=True)
axes[0,0].plot([0,1,2], label='test')
axes[1,0].plot([0,1,2], label='test 2')
fig.suptitle('a longer title')
But now increasing the plot height using the modified example
[...]
fig, axes = plt.subplots(nrows=2, ncols=2, figsize=(6, 12), constrained_layout=True)
[...]
shows the following overlapping title:
Is there anything that can be done here to find out why this is not taking into account the larger plot dimensions?
Originally posted by @asteppke in #5355 (comment)