Skip to content
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

FIX avoid registering the same colormap twice to matplotlib #464

Merged
merged 6 commits into from
Sep 16, 2022

Conversation

TomDLT
Copy link
Contributor

@TomDLT TomDLT commented Sep 16, 2022

Pycortex raises an error with matplotlib 3.6, when it tries to register the same colormap twice. This is because the check if self.cmap not in cm.__dict__ does not work anymore. (See recent changes to the colormaps API in matplotlib here)

This PR:

  • fixes how to check that the colormap is already registered
  • refactors duplicated code into a new method get_cmapdict in Dataview and DataviewRGB
  • add a test for clarity

I tested the fix with matplotlib 3.3 and 3.6.

Copy link
Contributor

@mvdoc mvdoc left a comment

Choose a reason for hiding this comment

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

Thanks!

@TomDLT TomDLT merged commit b134110 into gallantlab:main Sep 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants