diff --git a/currentscape/plotting.py b/currentscape/plotting.py index 0da7c9e..5525fe3 100644 --- a/currentscape/plotting.py +++ b/currentscape/plotting.py @@ -483,9 +483,9 @@ def get_colors(cmap, n_col): return x.mpl_colors[:n_col], False # is from matplotlib - new_cmap = matplotlib.cm.get_cmap(cmap, n_col) + new_cmap = matplotlib.colormaps[cmap].resampled(n_col) # check number of colors - if matplotlib.cm.get_cmap(cmap).N < n_col: + if matplotlib.colormaps[cmap].N < n_col: return list(new_cmap(range(n_col))), True return list(new_cmap(range(n_col))), False diff --git a/tests/test_currentscape_from_paper.py b/tests/test_currentscape_from_paper.py index 146b030..9514074 100644 --- a/tests/test_currentscape_from_paper.py +++ b/tests/test_currentscape_from_paper.py @@ -1,4 +1,5 @@ """Test that example produces a figure.""" + import os import sys from tests.utils import cwd diff --git a/tests/test_use_case_example.py b/tests/test_use_case_example.py index f53cbf8..f4e681f 100644 --- a/tests/test_use_case_example.py +++ b/tests/test_use_case_example.py @@ -1,4 +1,5 @@ """Test that example produces a figure.""" + import os import subprocess import sys diff --git a/tests/utils.py b/tests/utils.py index 681cfc1..8e9a4ee 100644 --- a/tests/utils.py +++ b/tests/utils.py @@ -1,4 +1,5 @@ """Utils.""" + import os from contextlib import contextmanager