Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Make sure SubFigure has _cachedRenderer#23174

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
tacaswell merged 1 commit intomatplotlib:mainfromoscargus:clabelsubfigures
Jun 2, 2022

Conversation

oscargus
Copy link
Member

@oscargusoscargus commentedJun 1, 2022
edited
Loading

PR Summary

Makes sure that_cachedRenderer is added toSubFigure instances by moving it toFigureBase.Closes#23173

Maybe the code in contour should behave differently, but I assume that sooner or later the same problem may happen in other code when applied to aSubFigure and not aFigure.

PR Checklist

Tests and Styling

  • Has pytest style unit tests (andpytest passes).
  • IsFlake 8 compliant (installflake8-docstrings and runflake8 --docstring-convention=all).

Documentation

  • [N/A] New features are documented, with examples if plot related.
  • [N/A] New features have an entry indoc/users/next_whats_new/ (follow instructions in README.rst there).
  • [N/A] API changes documented indoc/api/next_api_changes/ (follow instructions in README.rst there).
  • Documentation is sphinx and numpydoc compliant (the docs shouldbuild without error).

@oscargusoscargus changed the titleMake sure SubFigure have _cachedRendererMake sure SubFigure has _cachedRendererJun 1, 2022
@jklymak
Copy link
Member

I'm not sure this is the correct fix? The renderer for the subfigure should be the same as the parent's renderer. I think we need to set this up as a property and have the getter go up the tree to the parent?

@oscargus
Copy link
MemberAuthor

I'm not sure this is the correct fix?

No idea. What you says make sense though, so I'll give it a go.

@oscargus
Copy link
MemberAuthor

OndrawSubFigure redefines the_cachedRenderer. Will there ever be cases where it differs from the parent renderer?

@oscargus
Copy link
MemberAuthor

Updated with properties. Not convinced that one need to set the renderer indraw, but guess it shouldn't hurt?

@jklymak
Copy link
Member

The subfigure really should not have a cached renderer, but subfigures have been abstracted to be like figures so that child artists don't know if they are in a figure or a subfigure. So if an artist doesself.figure._cachedRenderer that should always point to the top-most renderer.

@jklymak
Copy link
Member

I think this is correct. Note that#22745 would have fixed this as well by callingfigure._get_renderer().

@oscargus
Copy link
MemberAuthor

Note that#22745 would have fixed this as well by callingfigure._get_renderer().

Ahh, OK! Maybe better to try to get that in then? I have not really followed (nor fully understand) that discussion.

I guess that the test added here very well can be worthwhile keeping as it seems to exercise the code in a way that once was (currently is) broken.

@jklymak
Copy link
Member

I think we can have both fixes.#22745 isn't necessarily going to go in ;-)

@tacaswelltacaswell added this to thev3.5.3 milestoneJun 1, 2022
@tacaswell
Copy link
Member

I suspect this is an argument as to why we actually do need to cache the renderer (and should move it to a central canonical place) and my position that we should not cache it at all is wrong (or at least currently infeasible).

Copy link
Member

@tacaswelltacaswell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Anyone can merge on green.

@tacaswell
Copy link
Member

I restarted the failed windows job (it was a blit test in a subprocess I have not seen fail before 🤞🏻 it is transient).

@tacaswelltacaswell merged commitaf83578 intomatplotlib:mainJun 2, 2022
@lumberbot-app
Copy link

Owee, I'm MrMeeseeks, Look at me.

There seem to be a conflict, please backport manually. Here are approximate instructions:

  1. Checkout backport branch and update it.
git checkout v3.5.xgit pull
  1. Cherry pick the first parent branch of the this PR on top of the older branch:
git cherry-pick -x -m1 af835787ac405d6021d4ed11e57734873c401b9c
  1. You will likely have some merge/cherry-pick conflict here, fix them and commit:
git commit -am 'Backport PR #23174: Make sure SubFigure has _cachedRenderer'
  1. Push to a named branch:
git push YOURFORK v3.5.x:auto-backport-of-pr-23174-on-v3.5.x
  1. Create a PR against branch v3.5.x, I would have named this PR:

"Backport PR#23174 on branch v3.5.x (Make sure SubFigure has _cachedRenderer)"

And apply the correct labels and milestones.

Congratulations — you did some good work! Hopefully your backport PR will be tested by the continuous integration and merged soon!

Remember to remove theStill Needs Manual Backport label once the PR gets merged.

If these instructions are inaccurate, feel free tosuggest an improvement.

tacaswell added a commit to tacaswell/matplotlib that referenced this pull requestJun 2, 2022
Merge pull requestmatplotlib#23174 from oscargus/clabelsubfiguresFIX: Make sure SubFigure has _cachedRenderer(cherry picked from commitaf83578)
timhoffm added a commit that referenced this pull requestJun 4, 2022
…-v3.5.xBackport PR#23174: Make sure SubFigure has _cachedRenderer
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@tacaswelltacaswelltacaswell approved these changes

@jklymakjklymakjklymak approved these changes

Assignees
No one assigned
Projects
None yet
Milestone
v3.5.3
Development

Successfully merging this pull request may close these issues.

[Bug]: Crash when adding clabels to subfigures
3 participants
@oscargus@jklymak@tacaswell

[8]ページ先頭

©2009-2025 Movatter.jp