From 566dd149320ca3f27c55008ec86f0b9b1044df4a Mon Sep 17 00:00:00 2001 From: Anton Goloborodko Date: Fri, 9 Aug 2024 10:27:26 +0200 Subject: [PATCH] an attempt to fix register_cmap import --- cooltools/lib/plotting.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/cooltools/lib/plotting.py b/cooltools/lib/plotting.py index e75ccf7..e8f1ac7 100644 --- a/cooltools/lib/plotting.py +++ b/cooltools/lib/plotting.py @@ -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 @@ -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()