Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Norms need scales for good colorbars... #16375

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

Open
jklymak opened this issue Jan 30, 2020 · 2 comments
Open

Norms need scales for good colorbars... #16375

jklymak opened this issue Jan 30, 2020 · 2 comments

Comments

@jklymak
Copy link
Member

jklymak commented Jan 30, 2020

Right now some color norms have accompanying scales, which allows their colorbars to have first-class scales. But some do not...

  • LogNorm: log
  • PowerNorm: no scale
  • TwoSlopeNorm: no scale
  • BoundaryNorm: shouldn't have a scale

Instead of inferring the first-class scale, I'd suggest we add a new property: norm._scale so that colorbar does not have to guess the scale. This should be a string so that it will only call registered scales, and it should be None when no scale is defined.

If its None, then colorbar will use the old default way of setting the scale. Otherwise it will set the scale using ax.set_yscale(norm._scale).

We probably don't want the user to set this - if they want to change the colorbar scale, they can simply use the normal ax.set_yscale directly.

@jklymak jklymak added this to the v3.3.0 milestone Jan 30, 2020
@anntzer
Copy link
Contributor

anntzer commented Jan 30, 2020

I have a patch at https://github.com/anntzer/matplotlib/tree/_wip/scale-norm that provides a _make_norm_from_scale factory that converts Scales to Norms with that intent. I haven't PR'd it yet both because it's still incomplete and because it goes on top of the yet-to-be-merged #14916 :)

@jklymak
Copy link
Member Author

jklymak commented Jan 31, 2020

@anntzer Overall #14916 looks right to me, but I hvanet reviewed carefully yet. Please ping me if I don't by the end of the w/e?

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

No branches or pull requests

3 participants