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

an attempt to fix register_cmap import in plotting #533

Merged
merged 1 commit into from
Aug 9, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions cooltools/lib/plotting.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
try:
from matplotlib.cm import register_cmap
except ImportError:
from matplotlib.colormaps import register
from matplotlib import colormaps
register_cmap = colormaps.register

import matplotlib as mpl
import matplotlib.pyplot as plt
Expand Down Expand Up @@ -99,8 +100,8 @@ def get_cmap(name):

def _register_cmaps():
for name, pal in PALETTES.items():
register_cmap(name, list_to_colormap(pal))
register_cmap(name + "_r", list_to_colormap(pal[::-1]))
register_cmap(list_to_colormap(pal), name=name)
register_cmap(list_to_colormap(pal[::-1]), name=name + "_r")


_register_cmaps()
Expand Down
Loading