-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
PiecewiseLinearNorm #5061
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
PiecewiseLinearNorm #5061
Conversation
Borrows heavily from @Tillsen's solution found on StackOverflow here: http://goo.gl/RPXMYB Used with his permission dicussesd on Github here: https://github.com/matplotlib/matplotlib/pull/3858`
This will allow the ticks of colors to be spaced as desired. Also simplified the math per the brilliant @joferkington http://stackoverflow.com/a/20146989/1552748
couldn't actually run the test suite b/c python iesn't installed as a framework.
Need to allow it in __call__ since colorbar can pass a value for clip.
To make it more similar to the other norms Also remove misleading comment about returning scalars
Since possibly some earlier versions of numpy returned a scalar, wrap the value in atleast_1d before indexing.
np.interp handles the case vmin == vcenter, we have to add a special case to make the last test case pass
Something that strikes me here, but I don't think for now, how the class inheritance goes
I.e. it should go from the most general at the end of the MRO to most specific at the top... instead we have the most specific, |
@OceanWolf |
@efiring by most specific I mean that as far as I can tell
I don't see what you mean by "additional LOC", as far as I see it we significantly reduce the LOC, i.e. the Normalise class becomes something like: class Normalize(DivergingNorm):
def __init__(self, vmin=None, vmax=None):
super(Normalize, self).__init__(vmin, None, vmax) |
Btw the is a lot of overlap between transforms and the norms, it would be nice - a properly quite difficult - to combine these. |
@Tillsten Yes, I have plans to do this with my MEP working on refactoring the axes #5029, I plan to merge the colourbar with the other axis code, essentially these Normalisations works as axis transformations, so it makes sense to me to simply the API here. As these extra norms have been pushed back to at least the 2.1 release next April, this gives me time to work on this MEP. We shall see how far I get with this. Help always appreciated, especially as I have MEP 22 and 27 to finish for 2.1 once 1.5 lands. |
See #12419 where I moved this PR (couldn't see force pushing here as viable) |
Working implementation of a
PiecewiseLinearNorm
, including aDivergingNorm
subclass.All the tests from the @dopplershift and @phobson at present pass apart from the tests that have norms that don't monotonically increase (i.e. they stay static) e.g. where vmin=vcenter and/or vcenter=vmax.
Should we allow this or not?