diff --git a/cortex/dataset/views.py b/cortex/dataset/views.py index ebeed772..edb12646 100644 --- a/cortex/dataset/views.py +++ b/cortex/dataset/views.py @@ -218,8 +218,8 @@ def get_cmapdict(self): if self.cmap not in colormaps: raise ValueError('Unkown color map %s' % self.cmap) I = plt.imread(colormaps[self.cmap]) - cmap = colors.ListedColormap(np.squeeze(I)) - cmap.name = self.cmap + name = self.cmap if isinstance(self.cmap, str) else self.cmap.name + cmap = colors.ListedColormap(np.squeeze(I), name=name) # Register colormap to matplotlib to avoid loading it again register_cmap(cmap) diff --git a/cortex/utils.py b/cortex/utils.py index f3b6ff8e..4a90ed2a 100644 --- a/cortex/utils.py +++ b/cortex/utils.py @@ -1007,8 +1007,7 @@ def get_cmap(name): colormaps = dict((c[:-4], os.path.join(cmapdir, c)) for c in colormaps) if name in colormaps: I = plt.imread(colormaps[name]) - cmap = colors.ListedColormap(np.squeeze(I)) - cmap.name = name + cmap = colors.ListedColormap(np.squeeze(I), name=name) try: register_cmap(cmap) except: