Skip to content
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

PowerNorm should have a scale... #20355

Open
jklymak opened this issue Jun 3, 2021 · 12 comments
Open

PowerNorm should have a scale... #20355

jklymak opened this issue Jun 3, 2021 · 12 comments

Comments

@jklymak
Copy link
Contributor

@jklymak jklymak commented Jun 3, 2021

We have a PowerNorm. We should define a PowerScale derived from a PowerTransform consistent with the log norm, etc. This will allow a proper scale for PowerNorm. I'm not exactly sure what such a scale should look like (i.e. where to put the ticks), but its probably not a linear scale.

@jklymak
Copy link
Contributor Author

@jklymak jklymak commented Jun 3, 2021

I'll mark as "Good first issue" because I think the example of LogNorm is relatively easy to follow and emulate down the stack. There is a bit of work to argue for the correct Locator and Formatter of the scale, but there must be examples out there.

@3r3n-n
Copy link

@3r3n-n 3r3n-n commented Jun 9, 2021

Hi !
Can I try to work on this ?

@anntzer
Copy link
Contributor

@anntzer anntzer commented Jun 9, 2021

See the discussion at #10234, #7294 (comment), #12665 regarding PowerNorm's semantics, though.

@yacth
Copy link

@yacth yacth commented Jun 12, 2021

Hi @jklymak,

Could you tell me more about where should I start, which files are involved in here ?
I am willing to help for this issue.

@jklymak
Copy link
Contributor Author

@jklymak jklymak commented Jun 12, 2021

colors.py and look at how LogNorm is constructed...

@yacth
Copy link

@yacth yacth commented Jun 13, 2021

Hi @jklymak could you explain me what this line does please ?

@_make_norm_from_scale(functools.partial(scale.LogScale, nonpositive="mask"))
@jklymak
Copy link
Contributor Author

@jklymak jklymak commented Jun 13, 2021

It makes the norm! Note nonpositive is a kwarg for LogScale. The functools.partial passes nonpsoitive="mask" to the init of the LogScale.

I actually don't know why @anntzer used functors.partial here rather than passing the init kwarg.

@anntzer
Copy link
Contributor

@anntzer anntzer commented Jun 13, 2021

I don't really remember, bu I guess that may be because using the init kwarg would have made nonpositive a kwarg to LogNorm, which it wasn't before?

@yacth
Copy link

@yacth yacth commented Jun 13, 2021

Ok I understand, thank you.
Thus we have to add the 'PowerScale' in 'scale.py' I believe ?

How should we define it ? @jklymak, you said that there must be an example out here.

@jklymak
Copy link
Contributor Author

@jklymak jklymak commented Jun 13, 2021

Again, trace what happens with LogScale...

@yacth
Copy link

@yacth yacth commented Jun 14, 2021

Hi @jklymak, I started the implementation in the scale.py file of :

  • PowerTransform : --> How we should define the distinctions for the base ? It seems that all bases could be fine with this Transform.
  • InvertedPowerTransform --> 100% done, it was similar to the InvertedLogTransform in the code architecture.
  • PowerScale : --> Do we have to redefine this inhirited method ? set_default_locators_and_formatters(self, axis)
@yacth
Copy link

@yacth yacth commented Jun 25, 2021

If I add this line :

@_make_norm_from_scale(
    scale.PowerScale,
    init=lambda gamma, vmin=None, vmax=None, clip=False: None)

just before the PowerNorm() class in the colors.py, it means I should access the kwargs for the PowerScale() in the scale.py file, am I right ?
Because I am trying to use them but in visual studio it says for example for vmin that "vmin" is not defined.

yacth added a commit to yacth/matplotlib that referenced this issue Jun 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants