From 44db522c55d31c49bbd2f122f2bdfd5f248df2d6 Mon Sep 17 00:00:00 2001 From: "Bryn N. Ubald" <55503826+bnubald@users.noreply.github.com> Date: Fri, 14 Jun 2024 16:20:45 +0100 Subject: [PATCH] Fixes #277: Switches to backwards compatible get_cmap Use plt.get_cmap for matplotlib>=3.9.0 support, as per https://matplotlib.org/stable/api/prev_api_changes/api_changes_3.9.0.html#removals --- icenet/plotting/forecast.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/icenet/plotting/forecast.py b/icenet/plotting/forecast.py index 8c25c29..e47f205 100644 --- a/icenet/plotting/forecast.py +++ b/icenet/plotting/forecast.py @@ -1127,10 +1127,10 @@ def sic_error_video(fc_da: object, obs_da: object, land_mask: object, logging.debug("Bounds of differences: {} - {}".format( diff_vmin, diff_vmax)) - sic_cmap = mpl.cm.get_cmap("Blues_r", 20) + sic_cmap = plt.get_cmap("Blues_r", 20) contour_kwargs = dict(vmin=0, vmax=1, cmap=sic_cmap) - diff_cmap = mpl.cm.get_cmap("RdBu_r", 20) + diff_cmap = plt.get_cmap("RdBu_r", 20) im1 = maps[0].imshow(fc_plot, **contour_kwargs) im2 = maps[1].imshow(obs_plot, **contour_kwargs) im3 = maps[2].imshow(diff_plot, @@ -1599,7 +1599,7 @@ def plot_forecast(): cmap_name = args.cmap_name logging.info("Using cmap {}".format(cmap_name)) - cmap = cm.get_cmap(cmap_name) + cmap = plt.get_cmap(cmap_name) cmap.set_bad("dimgrey") if args.region is not None: