8000 fig.suptitle overlapping with axis using constrained_layout · Issue #13672 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content
fig.suptitle overlapping with axis using constrained_layout #13672
Closed
@asteppke

Description

@asteppke

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') 

This results in
image

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:

image

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)

Metadata

Metadata

Assignees

Labels

topic: geometry managerLayoutEngine, Constrained layout, Tight layout

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    0