You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Bug summary
When a plot title/label consists of multiple lines (with some mathematics elements that require more vertical space), constrained_layout seems to not work correctly.
Code for reproduction
importmatplotlib.pyplotaspltfig, ax=plt.subplots(figsize=(3, 3), constrained_layout=True)
ax.set_title('First line \n'+r'Second line $\frac{x}{y}$')
ax.set_ylabel('ylabel')
ax.set_xlabel('xlabel')
fig.savefig('constrained_layout_issue.png')
Actual outcome
For now, I am avoiding this issue by increasing h_pad with plt.rcParams['figure.constrained_layout.h_pad'] = 6/72. But this doesn't feel right (there is a lot more blank space left at the bottom of the plot).
Bug report
Bug summary
When a plot title/label consists of multiple lines (with some mathematics elements that require more vertical space), constrained_layout seems to not work correctly.
Code for reproduction
Actual outcome

For now, I am avoiding this issue by increasing

h_pad
withplt.rcParams['figure.constrained_layout.h_pad'] = 6/72
. But this doesn't feel right (there is a lot more blank space left at the bottom of the plot).Matplotlib version
print(matplotlib.get_backend())
):The text was updated successfully, but these errors were encountered: