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

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Conversation

OceanWolf
Copy link
Member

Working implementation of aPiecewiseLinearNorm, 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?

phobsonand others added16 commitsSeptember 14, 2015 00:42
Borrows heavily from@Tillsen's solution found onStackOverflow here:http://goo.gl/RPXMYBUsed 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@joferkingtonhttp://stackoverflow.com/a/20146989/1552748
couldn't actually run the test suite b/c pythoniesn'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 normsAlso 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 caseto make the last test case pass
@OceanWolf
Copy link
MemberAuthor

Something that strikes me here, but I don't think for now, how the class inheritance goes

  1. object
  2. Normalise (2 stops min/max)
  3. PiecewiseLinearNorm (generic n stops)
  4. DivergingNorm (3 stops, min/center/max)

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,Normalise at the bottom... not something I specifically want to address now, both because I know I have a lot of more fundamental refactoring to do in this area, and I want to make sure I get that right before fiddling about here; and also because having slept on it, I would like to see the OrderedDict on the MRO, rather than existing as just an attribute, and that will have to wait until we drop python-2.6

@efiring
Copy link
Member

@OceanWolfNormalize is not themost specific, it is the simplest and most common. It is no more ore less specific than any of its subclasses. Yes, one could split out aNormalizeBase and use that as the common ancestor for all. Is the gain in formal structure worth the additional LOC and the extra level of redirection for the Normalize case, which is probably something like 95% of real world usage?

@OceanWolf
Copy link
MemberAuthor

@efiring by most specific I mean that as far as I can tellNormalize does the same thing asDivergingNorm but withvcenter = np.mean([vmin, vmax]).

DivergingNorm does the same thing asPiecewiseLinearNorm but with just one stop betweenvmin andvmax set specifically at the centre.

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:

classNormalize(DivergingNorm):def__init__(self,vmin=None,vmax=None):super(Normalize,self).__init__(vmin,None,vmax)

@Tillsten
Copy link
Contributor

Btw the is a lot of overlap between transforms and the norms, it would be nice - a properly quite difficult - to combine these.

@OceanWolf
Copy link
MemberAuthor

@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.

@tacaswelltacaswell added this to theproposed next point release (2.1) milestoneOct 8, 2015
@tacaswelltacaswell modified the milestones:2.1 (next point release),2.2 (next next feature release)Sep 24, 2017
@jklymak
Copy link
Member

See#12419 where I moved this PR (couldn't see force pushing here as viable)

@jklymakjklymak closed thisOct 6, 2018
@story645story645 removed this from thefuture releases milestoneOct 6, 2022
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers
No reviews
Assignees
No one assigned
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

9 participants
@OceanWolf@efiring@Tillsten@jklymak@tacaswell@story645@phobson@dopplershift@jkseppan

[8]ページ先頭

©2009-2025 Movatter.jp