Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[Bug]: constrained layout with wrapped titles #25336

Closed
@rcomer

Description

@rcomer

Bug summary

When titles are long and wrapped, constrained layout doesn't leave enough room for them.

Code for reproduction

import matplotlib.pyplot as plt

fig, ax_arr = plt.subplots(2, 2, figsize=(3, 3), layout="constrained")
fig.suptitle("suptitle that is clearly too long in this case", wrap=True)
ax_arr[1, 0].set_title("axes title that is too long for the size", wrap=True)
plt.savefig("test.png")

Actual outcome

test

Expected outcome

Enough space for the titles.

Additional information

There's no problem if the titles have an explicit new line ("\n"), so this seems to be specific to the wrapping.

Operating system

RHEL7

Matplotlib Version

3.7.0 and main

Matplotlib Backend

QtAgg

Python version

3.11.0

Jupyter version

N/A

Installation

conda

Metadata

Metadata

Assignees

No one assigned

    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