From a2185374ca2424cd93db96f8a1f8d90831ed5818 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jaquier=20Aur=C3=A9lien=20Tristan?= Date: Wed, 29 May 2024 15:54:22 +0200 Subject: [PATCH 1/2] remove deprecated get_cmap Change-Id: I0ebd1fc1495e3b0948326e230ec49a785b934080 --- currentscape/plotting.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 From 2d5fe03e588929229656f29fff720cc2c7228211 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jaquier=20Aur=C3=A9lien=20Tristan?= Date: Wed, 29 May 2024 16:05:46 +0200 Subject: [PATCH 2/2] black fix Change-Id: Ib3b542630ed68299c5bea2ea1bae6ff73b7bf8f6 --- tests/test_currentscape_from_paper.py | 1 + tests/test_use_case_example.py | 1 + tests/utils.py | 1 + 3 files changed, 3 insertions(+) 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