Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

fig.suptitle overlapping with axis using constrained_layout #13672

Copy link
Copy link
Closed
@asteppke

Description

@asteppke
Issue body actions

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)

jklymak

Metadata

Metadata

Assignees

Labels

topic: geometry managerLayoutEngine, Constrained layout, Tight layoutLayoutEngine, Constrained layout, Tight layout

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    Morty Proxy This is a proxified and sanitized view of the page, visit original site.