Skip to content

Suptitle positioning messed up in 3.4.0 #19803

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
emazep opened this issue Mar 28, 2021 · 5 comments · Fixed by #19805
Closed

Suptitle positioning messed up in 3.4.0 #19803

emazep opened this issue Mar 28, 2021 · 5 comments · Fixed by #19805
Milestone

Comments

@emazep
Copy link

emazep commented Mar 28, 2021

If I run the following code:

import matplotlib.pyplot as plt
plt.subplots()
plt.suptitle('SUPTITLE TEST')

I get:

image

which says that the title is placed in x=0.5, y=0.98 (which, according to the docs, is its default position). However if I do:

plt.suptitle('SUPTITLE TEST', x=0.5, y=0.98)

it still says that the text is placed in x=0.5, y=0.98, but it is completely disappeared:

image

I think because it goes out of the image boundaries, as if I do:

plt.suptitle('SUPTITLE TEST', y=0.93)

I get the title vertically cut, instead of obtaining the space to accommodate it:

image

Also, setting x to any value but not setting y, such as in:

plt.suptitle('SUPTITLE TEST', x=0.5)

makes the title disappear as well:

image

I can also cut the title horizontally, for example with:

plt.suptitle('SUPTITLE TEST', x=0.1, y=0.92)

which produces:

image

Basically I cannot position the title anymore, while it was easily doable until 3.3.4.

Thank you.

Matplotlib version

  • Operating system: any
  • Matplotlib version: 3.4.0
  • Matplotlib backend: module://ipykernel.pylab.backend_inline
  • Python version: 3.9.2
@emazep emazep changed the title Suptitle positioning messed up in matplotlib 3.4.0 Suptitle positioning messed up in 3.4.0 Mar 28, 2021
@jklymak
Copy link
Member

jklymak commented Mar 28, 2021

Sorry about this - it is the constrained layout rewrite. Hopefully an easy fix

@jklymak
Copy link
Member

jklymak commented Mar 28, 2021

BTW< a work around for your manually-placed subtitles is tlt = plt.suptitle('Boo'); tlt.set_in_layout(True).

@jklymak
Copy link
Member

jklymak commented Mar 28, 2021

This should be fixed in 3.4.1. Sorry for the bother

@tacaswell tacaswell added this to the v3.4.1 milestone Mar 28, 2021
@emazep
Copy link
Author

emazep commented Mar 28, 2021

This should be fixed in 3.4.1. Sorry for the bother

Don't mention it and thank you for your quick fix. This library not only has a nearly infinite power and flexibility, but also a stellar support!

@jklymak
Copy link
Member

jklymak commented Mar 29, 2021

Well, the stellar support at least tries to fix things they gratuitously broke 😉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants