Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions mplotutils/_colormaps.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def _color_palette(cmap, n_colors):
colors_i = np.linspace(0, 1.0, n_colors)
if isinstance(cmap, (list, tuple)):
# we have a list of colors
cmap = ListedColormap(cmap, N=n_colors)
cmap = ListedColormap(cmap)
pal = cmap(colors_i)
elif isinstance(cmap, str):
# we have some sort of named palette
Expand All @@ -71,7 +71,7 @@ def _color_palette(cmap, n_colors):
pal = color_palette(cmap, n_colors=n_colors)
except (ValueError, ImportError):
# or maybe we just got a single color as a string
cmap = ListedColormap([cmap], N=n_colors)
cmap = ListedColormap([cmap] * n_colors)
pal = cmap(colors_i)
else:
# cmap better be a LinearSegmentedColormap (e.g. viridis)
Expand Down
1 change: 1 addition & 0 deletions mplotutils/tests/test_hatch.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ def test_hatch_linewidth_mpl_lt_310(function):


@requires_mpl_ge_310
@pytest.mark.filterwarnings("ignore:Passing 'N' to ListedColormap is deprecated")
@pytest.mark.parametrize("function", HATCH_FUNCTIONS)
def test_hatch_linewidth_mpl_ge_310(function):

Expand Down
Loading