Skip to content

Commit f608f25

Browse files
authored
Merge pull request #533 from open2c/fix_register_cmap_import
an attempt to fix register_cmap import in plotting
2 parents 5655cf2 + 566dd14 commit f608f25

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

cooltools/lib/plotting.py

+4-3
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
try:
66
from matplotlib.cm import register_cmap
77
except ImportError:
8-
from matplotlib.colormaps import register
8+
from matplotlib import colormaps
9+
register_cmap = colormaps.register
910

1011
import matplotlib as mpl
1112
import matplotlib.pyplot as plt
@@ -99,8 +100,8 @@ def get_cmap(name):
99100

100101
def _register_cmaps():
101102
for name, pal in PALETTES.items():
102-
register_cmap(name, list_to_colormap(pal))
103-
register_cmap(name + "_r", list_to_colormap(pal[::-1]))
103+
register_cmap(list_to_colormap(pal), name=name)
104+
register_cmap(list_to_colormap(pal[::-1]), name=name + "_r")
104105

105106

106107
_register_cmaps()

0 commit comments

Comments
 (0)