Skip to content

Commit

Permalink
an attempt to fix register_cmap import
Browse files Browse the repository at this point in the history
  • Loading branch information
golobor committed Aug 9, 2024
1 parent 5655cf2 commit 566dd14
Showing 1 changed file with 4 additions and 3 deletions.
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

0 comments on commit 566dd14

Please sign in to comment.