Skip to content

when using plt.tight_layout(), figure title overlaps subplot titles #17792

Closed
@dfmim

Description

@dfmim

Bug report

I have a figure with 2x3 subplots. Each subplot has a title as does the whole figure. However, even when using plt.tight_layout(), the figure title overlaps the subplot titles on the top row. Looking at StackOverflow, this has been a problem for a while.

Code for reproduction

# Paste your code here
import matplotlib.pyplot as plt
fig, axs = plt.subplots(2, 3)
fig.suptitle('ANON-WL0002')
axs[0, 0].set_title('Slice Dice')
axs[0, 1].set_title('Volumetric Dice')
axs[1, 0].set_title('Slice Hausdorff Dist.')
axs[1, 1].set_title('Volumetric Hausdorff Dist.')
axs[0, 2].set_title('All Slice Dice')
axs[1, 2].set_title('All Volumetric Dice')
plt.tight_layout()
plt.show()

Actual outcome

Figure_1

Expected outcome
The 'ANON-WL0002' should be above the subplot titles

Matplotlib version

  • Operating system: Windows 10
  • Matplotlib version: 3.1.3
  • Matplotlib backend (print(matplotlib.get_backend())): module://ipykernel.pylab.backend_inline
  • Python version: 3.7
  • Jupyter version (if applicable): N/A
  • Other libraries:

matplotlib installed as part of anaconda distribution

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions