Skip to content

[Bug]: new constrained_layout causes axes to go invisible(?) #22264

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
anntzer opened this issue Jan 19, 2022 · 8 comments
Closed

[Bug]: new constrained_layout causes axes to go invisible(?) #22264

anntzer opened this issue Jan 19, 2022 · 8 comments
Labels
status: needs clarification Issues that need more information to resolve. topic: geometry manager LayoutEngine, Constrained layout, Tight layout
Milestone

Comments

@anntzer
Copy link
Contributor

anntzer commented Jan 19, 2022

Bug summary

Since #20426, plt.figure(constrained_layout=True).subplots(3) (or layout="constrained") shows no axes whatsoever.
attn @jklymak, I guess :)

Code for reproduction

See above.

Actual outcome

Blank figure.

Expected outcome

Not blank figure.

Additional information

No response

Operating system

fedora

Matplotlib Version

HEAD, bisects to #20426.

Matplotlib Backend

mplcairo

Python version

310

Jupyter version

No response

Installation

git checkout

@anntzer anntzer added Release critical For bugs that make the library unusable (segfaults, incorrect plots, etc) and major regressions. topic: geometry manager LayoutEngine, Constrained layout, Tight layout labels Jan 19, 2022
@jklymak jklymak added the status: needs clarification Issues that need more information to resolve. label Jan 19, 2022
@jklymak
Copy link
Member

jklymak commented Jan 19, 2022

I can't reproduce. And obviously we test CL pretty heavily, so all our tests would fail if that didn't work at all. So you must have something else in your setup causing the problem.

@jklymak
Copy link
Member

jklymak commented Jan 19, 2022

(Well, OK, I didn't try and reproduce with mplcairo)...

@anntzer
Copy link
Contributor Author

anntzer commented Jan 19, 2022

Oh, that's interesting... this only occurs with mplcairo, even though I would have thought this touched something completely orthogonal to the actual renderer (this is why I didn't think about checking that part). I'll investigate, sorry for the noise.

@jklymak
Copy link
Member

jklymak commented Jan 19, 2022

Well, it is weird that it doesn't work w/ mplcairo. If there is something we need to fix, we should try before release...

@anntzer
Copy link
Contributor Author

anntzer commented Jan 19, 2022

Do you know if the sequence of draws changed with #20426?

@jklymak
Copy link
Member

jklymak commented Jan 19, 2022

Not on purpose. However I think things changed so that the layout parameters were not hard coded when the gridspecs are created. Ie the width ratios etc are done at drawtime. That allows you to change the gridspec width ratios and have it take effect. However I think this went in before #20426

@anntzer
Copy link
Contributor Author

anntzer commented Jan 20, 2022

OK, I figured out that this occured because I was doing some weird dance to try to reuse renderer instances in order to not invalidate the text layout cache (now see #22271, which doesn't immediately address the text cache but is preliminary work in that direction), but #20426 changed something and I ended up drawing to a draw-disabled renderer. I just stripped out most of the caching for now.
Perhaps still worth figuring out exactly what changed, but I guess I can just milestone this as 3.6 for myself and have a look when I can, with less urgency.

@anntzer anntzer removed the Release critical For bugs that make the library unusable (segfaults, incorrect plots, etc) and major regressions. label Jan 20, 2022
@anntzer anntzer added this to the v3.6.0 milestone Jan 20, 2022
@jklymak
Copy link
Member

jklymak commented Jan 20, 2022

I'm going to close this since it is working as expected for unpatched Matplotlib. If when adding your "weird" renderer dance you come up with a flaw in how constrained_layout is implemented, feel free to re-raise the issue, but there is nothing actionable for the rest of us (yet).

@jklymak jklymak closed this as completed Jan 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: needs clarification Issues that need more information to resolve. topic: geometry manager LayoutEngine, Constrained layout, Tight layout
Projects
None yet
Development

No branches or pull requests

2 participants