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

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

Merged

Conversation

timhoffm
Copy link
Member

@timhoffmtimhoffm commentedDec 8, 2019
edited
Loading

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 viaregister_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 ofregister_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

  • Code isFlake 8 compliant
  • Documentation is sphinx and numpydoc compliant
  • Documented in doc/api/api_changes.rst if API changed in a backward-incompatible way

@timhoffmtimhoffmforce-pushed thedeprecate-register_cmap-data branch from7524ced to38d7e06CompareDecember 8, 2019 12:13
Copy link
Contributor

@anntzeranntzer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

postci

Copy link
Member

@tacaswelltacaswell left a 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.

@timhoffmtimhoffmforce-pushed thedeprecate-register_cmap-data branch from38d7e06 toeb61e47CompareDecember 8, 2019 21:09
@timhoffm
Copy link
MemberAuthor

Rebase done. Taking the liberty to self-merge based on the two positive reviews.

@timhoffmtimhoffm merged commit0e0d72a intomatplotlib:masterDec 9, 2019
@timhoffmtimhoffm deleted the deprecate-register_cmap-data branchDecember 9, 2019 20:35
tacaswell added a commit to tacaswell/matplotlib that referenced this pull requestSep 24, 2020
tacaswell added a commit to tacaswell/matplotlib that referenced this pull requestSep 25, 2020
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.
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@dstansbydstansbydstansby left review comments

@tacaswelltacaswelltacaswell approved these changes

@anntzeranntzeranntzer approved these changes

Assignees
No one assigned
Projects
None yet
Milestone
v3.3.0
Development

Successfully merging this pull request may close these issues.

4 participants
@timhoffm@tacaswell@anntzer@dstansby

[8]ページ先頭

©2009-2025 Movatter.jp