Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork7.9k
Deprecate implicit creation of colormaps in register_cmap()#15875
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
Uh oh!
There was an error while loading.Please reload this page.
Conversation
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
7524ced
to38d7e06
CompareThere 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.
postci
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.
Needs a re-base to resolve conflict in deprecation docs.
38d7e06
toeb61e47
CompareRebase done. Taking the liberty to self-merge based on the two positive reviews. |
This was deprecated in 3.3 viamatplotlib#15875
This was deprecated in 3.3 viamatplotlib#15875Enforce type of cmap as Colormap because we may not know that theobject registered is of the wrong type until well after it wasregistered, defensively check here.We could do a duck-type check, but this is much simpler and we cancross the bridge of writing a duck-type checking function when someonehas a use case for registeringcompatible-but-not-derived-from-Colormap instances.
Uh oh!
There was an error while loading.Please reload this page.
PR Summary
register_cmap() could be used either with a Colormap, or by passing data to implicitly create a colormap from.
This PR deprecates the second way in favor of explicitly creating colormaps via
register_cmap(cmap=LinearSementedColormap(name, data lut))
.Having both ways is redundant, makes the function more complicated, and unnecessarily pulls colormap implementation details (like thelut) into the API of
register_cmap()
. Given that colormap registration is only done very rarely, the benefit of a sligtly shorter callregister_cmap(name, data=data, lut=lut)
is negligable. It's even error prone becausedata has to be passed as kwarg since the second arg is the for this case unusedcmap parameter.PR Checklist