Skip to content

[Bug]: 3D ax1's tick labels and ax2's title overlap in a constrained layout #31277

@williamlus

Description

Bug summary

I create a figure with a constrained layout and add a 3D-subplot at the top and a 2D-subplot at the bottom, but the tick labels of the 3D-subplot overlap with the title of the 2D-subplot.

Code for reproduction

import matplotlib.pyplot as plt

fig = plt.figure(constrained_layout=True)
ax1 = fig.add_subplot(2, 1, 1, projection='3d')
ax1.set_title('3D Plot')
ax2 = fig.add_subplot(2, 1, 2)
ax2.set_title('2D Plot')

plt.show()

Actual outcome

Image

Expected outcome

Image

Additional information

No response

Operating system

No response

Matplotlib Version

3.10.8

Matplotlib Backend

No response

Python version

No response

Jupyter version

No response

Installation

None

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions