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

ENH: add a copy method to colormaps#19663

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
QuLogic merged 2 commits intomatplotlib:masterfromjklymak:enh-add-colormap-copy
Mar 9, 2021

Conversation

jklymak
Copy link
Member

@jklymakjklymak commentedMar 7, 2021
edited
Loading

PR Summary

Right now we are deprecating access to the global colormaps, but users can only avoid it by doingnewcmap = copy.copy(cmap) which is a bit heavy-handed. Here we provide a simplecopy method toColormap so we can donewcmap = cmap.copy().

See discussion in#19609,#16991,#18503

PR Checklist

  • Has pytest style unit tests (andpytest passes).
  • IsFlake 8 compliant (runflake8 on changed files to check).
  • New features are documented, with examples if plot related.
  • Documentation is sphinx and numpydoc compliant (the docs shouldbuild without error).
  • Conforms to Matplotlib style conventions (installflake8-docstrings and runflake8 --docstring-convention=all).
  • New features have an entry indoc/users/next_whats_new/ (follow instructions in README.rst there).
  • API changes documented indoc/api/next_api_changes/ (follow instructions in README.rst there).

Copy link
Member

@timhoffmtimhoffm left a comment
edited
Loading

Choose a reason for hiding this comment

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

While I don't want to put acopy() method on every object, it makes sense here. With this method we make copying simpler and thus promote the needed copying at least for the transition period.

Milestoned for 3.4 - this should have been already introduced with the changes in 3.3. If we don't get it in 3.4 a major purpose ( the easier user-copy workaround in the transition period) is gone.

@timhoffmtimhoffm added this to thev3.4.0 milestoneMar 7, 2021
Co-authored-by: Tim Hoffmann <2836374+timhoffm@users.noreply.github.com>
@jklymak
Copy link
MemberAuthor

Agreed, that we definitely don't want a copy method on everything. But most classes aren't primarily coming from global instances, and hence usually can be made from scratch. Whereas colormaps are probably 99% coming from the global list, so I think we should make it easy to move into user scope.

@QuLogicQuLogic merged commitfba5d15 intomatplotlib:masterMar 9, 2021
meeseeksmachine pushed a commit to meeseeksmachine/matplotlib that referenced this pull requestMar 9, 2021
@jklymakjklymak deleted the enh-add-colormap-copy branchMarch 9, 2021 02:15
QuLogic added a commit that referenced this pull requestMar 9, 2021
…663-on-v3.4.xBackport PR#19663 on branch v3.4.x (ENH: add a copy method to colormaps)
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@QuLogicQuLogicQuLogic approved these changes

@timhoffmtimhoffmtimhoffm approved these changes

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

Successfully merging this pull request may close these issues.

3 participants
@jklymak@QuLogic@timhoffm

[8]ページ先頭

©2009-2025 Movatter.jp