Skip to content

Commit

Permalink
Merge pull request #533 from open2c/fix_register_cmap_import
Browse files Browse the repository at this point in the history
an attempt to fix register_cmap import in plotting
  • Loading branch information
golobor authored Aug 9, 2024
2 parents 5655cf2 + 566dd14 commit f608f25
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 f608f25

Please sign in to comment.