-
Notifications
You must be signed in to change notification settings - Fork 2
Added PowerScale similar to LogScale as per 20355 #2
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
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for opening your first PR into Matplotlib!
If you have not heard from us in a week or so, please leave a new comment below and that should bring it to our attention. Most of our reviewers are volunteers and sometimes things fall through the cracks.
You can also join us on gitter for real-time discussion.
For details on testing, writing docs, and our review process, please see the developer guide
We strive to be a welcoming and open project. Please follow our Code of Conduct.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are a few additional things we need to address before going forward. I have left some remarks.
In addition to this, you need to add 'power': PowerScale
to the _scale_mapping
dictionary in scale.py
so that PowerScale is registered.
return self._transform | ||
|
||
def set_default_locators_and_formatters(self, axis): | ||
axis.set_major_locator(AutoLocator()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Other scales use their own custom locator so I don't think AutoLocator
is supposed to be used here. I think we would probably have to define a new tick locator PowerLocator
to be used here.
PowerNorm = make_norm_from_scale( | ||
functools.partial(scale.PowerScale))(Normalize) | ||
PowerNorm.__name__ = PowerNorm.__qualname__ = "PowerNorm" | ||
PowerNorm.__doc__ = "Normalize a given value to the 0-1 range using a power-law scale." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there any reason to define PowerNorm
like this. I see that only LogNorm
uses this kind of definition, while all other norms define a class like this:
@make_norm_from_scale(
scale.FuncScale,
init=lambda functions, vmin=None, vmax=None, clip=False: None)
class FuncNorm(Normalize):
"""
Arbitrary normalization using functions for the forward and inverse.
It would be better if we do what other norms follow.
PR summary
Added PowerScale PowerTransform InversePowerTransform to scale.py
Changed PowerNorm and made it similar to LogNorm in colors.py
PR checklist