Skip to content

Commit

Permalink
FIX do not register colormap if already done (#512)
Browse files Browse the repository at this point in the history
  • Loading branch information
Matlmr authored Nov 30, 2023
1 parent 45772ed commit ef39861
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion cortex/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit ef39861

Please sign in to comment.