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

FIX: Only send one update signal when autoscaling norms#25079

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
ksunden merged 1 commit intomatplotlib:mainfromgreglucas:norm-autoscale-signal
Jan 25, 2023

Conversation

greglucas
Copy link
Contributor

PR Summary

Signal are sent for every vmin/vmax update, when autoscaling we were changing vmin/vmax to None, then updating them which would cause 4 update signals to be sent. We really don't care about the intermediate signals and only want a single one sent after all the updates are complete.

closes#25077

NOTE: The colorbar says "if not norm.scaled(): set vmin/vmax to 0, 1" which doesn't work for the LogNorm scales. Perhaps we should also change that arbitrary 0, 1 expansion. But, this at least makes sure we don't go through thevmin=None path here while we are actively updating the norm.

PR Checklist

Documentation and Tests

  • Has pytest style unit tests (andpytest passes)
  • [-] Documentation is sphinx and numpydoc compliant (the docs shouldbuild without error).
  • [-] New plotting related features are documented with examples.

Release Notes

  • [-] New features are marked with a.. versionadded:: directive in the docstring and documented indoc/users/next_whats_new/
  • [-] API changes are marked with a.. versionchanged:: directive in the docstring and documented indoc/api/next_api_changes/
  • [-] Release notes conform with instructions innext_whats_new/README.rst ornext_api_changes/README.rst

Signal are sent for every vmin/vmax update, when autoscaling we werechanging vmin/vmax to None, then updating them which would cause 4update signals to be sent. We really don't care about the intermediatesignals and only want a single one sent after all the udpates are complete.
Comment on lines +1365 to +1369
with self.callbacks.blocked():
# Pause callbacks while we are updating so we only get
# a single update signal at the end
self.vmin = self.vmax = None
self.autoscale_None(A)
Copy link
Member

Choose a reason for hiding this comment

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

Maybe just?

Suggested change
withself.callbacks.blocked():
# Pause callbacks while we are updating so we only get
# a single update signal at the end
self.vmin=self.vmax=None
self.autoscale_None(A)
ifA.size():
self.vmin=A.min()
self.vmax=A.max()

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

subclasses overwriteautoscale_None() to handle that themselves, so I think we need to defer to their implementations. I'd save that for another PR if someone wants to tackle it.

jklymak reacted with thumbs up emoji
@jklymak
Copy link
Member

I'm still a little grumpy aboutnorm.vmin = None triggering a callback - it is certainly a case where I think an explicit setter is more clear than properties because you think to look for whatset_vmin does rather than just expect it to assign a value, not also do a bunch of other things... But, this fix should go in ASAP, either my suggestion or the original is fine.

@ksundenksunden merged commit4f24e3c intomatplotlib:mainJan 25, 2023
meeseeksmachine pushed a commit to meeseeksmachine/matplotlib that referenced this pull requestJan 25, 2023
QuLogic added a commit that referenced this pull requestJan 25, 2023
…079-on-v3.7.xBackport PR#25079 on branch v3.7.x (FIX: Only send one update signal when autoscaling norms)
@greglucasgreglucas deleted the norm-autoscale-signal branchJanuary 31, 2023 17:32
@ksundenksunden mentioned this pull requestFeb 20, 2023
6 tasks
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@jklymakjklymakjklymak approved these changes

@ksundenksundenksunden approved these changes

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

Successfully merging this pull request may close these issues.

[Bug]: Setting norm with existing colorbar fails with 3.6.3
3 participants
@greglucas@jklymak@ksunden

[8]ページ先頭

©2009-2025 Movatter.jp