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: fix colorbars with no scales#20327

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

Conversation

jklymak
Copy link
Member

@jklymakjklymak commentedMay 28, 2021
edited
Loading

PR Summary

Closes#20324

The colorbar re-write#20054, needs a scale for the colorbar. Which worked great for most of our Norms because they are all created from a scale now:

def_make_norm_from_scale(scale_cls,base_norm_cls=None,*,init=None):

However, astropy did not derive their norms from a scale, so they had a failure (which I hope this fixes).astropy/astropy#11800

We also had norms likeTwoSlopeNorm that do not derive from a scale, though they probably should/could.

Here the proposal is that if there is no scale on the norm, the scale is afunction scale with the forward and inverse from the norm. This works fine forTwoSlopeNorm (ahem, after we define the inverse for it, which really should have been done when it went in; that took a bit of work to realize).

PR Checklist

  • Has pytest style unit tests (andpytest passes).
  • IsFlake 8 compliant (runflake8 on changed files to check).
  • New features are documented, with examples if plot related.
  • Documentation is sphinx and numpydoc compliant (the docs shouldbuild without error).
  • Conforms to Matplotlib style conventions (installflake8-docstrings and runflake8 --docstring-convention=all).
  • New features have an entry indoc/users/next_whats_new/ (follow instructions in README.rst there).
  • API changes documented indoc/api/next_api_changes/ (follow instructions in README.rst there).

@jklymakjklymak added this to thev3.5.0 milestoneMay 28, 2021
@jklymakjklymak added the Release criticalFor bugs that make the library unusable (segfaults, incorrect plots, etc) and major regressions. labelMay 28, 2021
@jklymakjklymakforce-pushed thefix-colorbars-with-no-scale branch 2 times, most recently from2177d8c to52a6aa8CompareMay 28, 2021 22:42
@@ -1152,7 +1152,7 @@ def __init__(self, vmin=None, vmax=None, clip=False):
self.vmin = _sanitize_extrema(vmin)
self.vmax = _sanitize_extrema(vmax)
self.clip = clip
self._scale =scale.LinearScale(axis=None)
self._scale = None # will default to LinearScale for colorbar
Copy link
MemberAuthor

Choose a reason for hiding this comment

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

Note downstream libraries will likely derive from Normalize, so scale should be None so their norm gets used...

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

@dstansby can you see if this version works?

Copy link
Member

Choose a reason for hiding this comment

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

Yep, seems to work well with this version.

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

Any chance of a formal review?

@jklymakjklymakforce-pushed thefix-colorbars-with-no-scale branch from7867fc3 to1e8658dCompareMay 29, 2021 20:55
@image_comparison(['colorbar_twoslope.png'], remove_text=True,
style='mpl20')
def test_twoslope_colorbar():
# Note that the first tick = 20, and should be in the middle
Copy link
Contributor

Choose a reason for hiding this comment

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

Adding the ticklabels to the image would be helpful here.

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

Yeah, I agree, but we really try to avoid labels, because they cause image comparison problems when the font library changes...

@jklymakjklymak mentioned this pull requestJun 3, 2021
7 tasks
@jklymakjklymakforce-pushed thefix-colorbars-with-no-scale branch from87b8ae7 tod1c5a6aCompareJune 3, 2021 14:34
@anntzeranntzer merged commit29da23a intomatplotlib:masterJun 10, 2021
@jklymakjklymak deleted the fix-colorbars-with-no-scale branchJune 10, 2021 20:09
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@dstansbydstansbydstansby left review comments

@greglucasgreglucasgreglucas left review comments

@QuLogicQuLogicQuLogic approved these changes

@anntzeranntzeranntzer approved these changes

Assignees
No one assigned
Labels
Release criticalFor bugs that make the library unusable (segfaults, incorrect plots, etc) and major regressions.topic: color/colorbar
Projects
None yet
Milestone
v3.5.0
Development

Successfully merging this pull request may close these issues.

New colorbar doesn't handle norms without a scale properly...
5 participants
@jklymak@QuLogic@anntzer@dstansby@greglucas

[8]ページ先頭

©2009-2025 Movatter.jp