Skip to content

Commit 1304559

Browse files
committed
Fix _show_bars bug, make N=nlevs change colormap name
1 parent 6b08b94 commit 1304559

File tree

1 file changed

+5
-17
lines changed

1 file changed

+5
-17
lines changed

proplot/styletools.py

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -782,10 +782,6 @@ def __init__(self, *args, cyclic=False, alpha=None, **kwargs):
782782
if alpha is not None:
783783
self.set_alpha(alpha)
784784

785-
def _resample(self, N):
786-
"""Return a resampled copy of the colormap with the same name."""
787-
return self.updated(name=self.name, N=N)
788-
789785
def concatenate(self, *args, ratios=1, name=None, N=None, **kwargs):
790786
"""
791787
Return the concatenation of this colormap with the
@@ -1610,10 +1606,6 @@ def _init(self):
16101606
self._lut[i, :3] = to_rgb(self._lut[i, :3], self._space)
16111607
self._lut[:, :3] = _clip_colors(self._lut[:, :3], self._clip)
16121608

1613-
def _resample(self, N):
1614-
"""Return a resampled copy of the colormap with the same name."""
1615-
return self.updated(name=self.name, N=N)
1616-
16171609
@staticmethod
16181610
def from_color(name, color, fade=None, space='hsl', **kwargs):
16191611
"""
@@ -2251,13 +2243,10 @@ def Colormap(
22512243
cmaps.append(cmap)
22522244

22532245
# Merge the result of this arbitrary user input
2254-
N = kwargs.pop('N', None)
22552246
if len(cmaps) > 1: # more than one map?
2256-
cmap = cmaps[0].concatenate(*cmaps[1:], N=N, **kwargs)
2247+
cmap = cmaps[0].concatenate(*cmaps[1:], **kwargs)
22572248
elif kwargs: # modify any props?
22582249
cmap = cmaps[0].updated(**kwargs)
2259-
elif N:
2260-
cmap = cmap._resample(N)
22612250

22622251
# Cut the center and roate the colormap
22632252
if cut is not None:
@@ -3243,9 +3232,9 @@ def _draw_bars(
32433232
ax = axs[iax]
32443233
cmap = mcm.cmap_d[name]
32453234
if N is not None:
3246-
cmap = cmap._resample(N)
3235+
cmap = cmap.updated(N=N)
32473236
ax.colorbar( # TODO: support this in public API
3248-
mcm.cmap_d[name], loc='_fill',
3237+
cmap, loc='_fill',
32493238
orientation='horizontal', locator='null', linewidth=0
32503239
)
32513240
ax.text(
@@ -3577,7 +3566,7 @@ def _color_filter(i, hcl): # noqa: E306
35773566
return figs
35783567

35793568

3580-
def show_cmaps(*args, N=None, **kwargs):
3569+
def show_cmaps(*args, **kwargs):
35813570
"""
35823571
Generate a table of the registered colormaps or the input colormaps
35833572
categorized by source. Adapted from `this example \
@@ -3607,9 +3596,8 @@ def show_cmaps(*args, N=None, **kwargs):
36073596
The figure.
36083597
"""
36093598
# Have colormaps separated into categories
3610-
N = _notNone(N, rcParams['image.lut'])
36113599
if args:
3612-
names = [Colormap(cmap, N=N).name for cmap in args]
3600+
names = [Colormap(cmap).name for cmap in args]
36133601
else:
36143602
names = [
36153603
name for name in mcm.cmap_d.keys() if

0 commit comments

Comments
 (0)