From ef39861af1a9d40c699caee818eef9b329c2a198 Mon Sep 17 00:00:00 2001 From: Mathis Lamarre <32335474+Matlmr@users.noreply.github.com> Date: Thu, 30 Nov 2023 23:38:05 +0100 Subject: [PATCH] FIX do not register colormap if already done (#512) --- cortex/utils.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/cortex/utils.py b/cortex/utils.py index edcd3aa7..03f46179 100644 --- a/cortex/utils.py +++ b/cortex/utils.py @@ -1001,7 +1001,10 @@ def get_cmap(name): if name in colormaps: I = plt.imread(colormaps[name]) cmap = colors.ListedColormap(np.squeeze(I)) - plt.cm.register_cmap(name,cmap) + try: + plt.cm.register_cmap(name,cmap) + except: + print(f"Color map {name} is already registered.") else: try: cmap = plt.cm.get_cmap(name)