From f87f764d9eead8ab1c63fbaffc5985f99c8c32b6 Mon Sep 17 00:00:00 2001 From: Jordan Landers <10099739+jordanplanders@users.noreply.github.com> Date: Sat, 1 Jun 2024 22:14:05 -0700 Subject: [PATCH] another get_cmap fix (#564) * another get_cmap fix * scrap keep_center_colormap ex --- pyleoclim/utils/plotting.py | 20 +------------------- 1 file changed, 1 insertion(+), 19 deletions(-) diff --git a/pyleoclim/utils/plotting.py b/pyleoclim/utils/plotting.py index 9f247fdb..81c362a8 100644 --- a/pyleoclim/utils/plotting.py +++ b/pyleoclim/utils/plotting.py @@ -1395,24 +1395,6 @@ def keep_center_colormap(cmap, vmin, vmax, center=0): the centered value across the data. This adjusted colormap can then be used for data visualization tasks where maintaining a perceptual 'zero' or central reference point is important. - - Examples - -------- - - .. jupyter-execute:: - - import matplotlib.pyplot as plt - import pyleoclim as pyleo - - new_colormap = pyleo.utils.plotting.keep_center_colormap('RdBu', vmin=-300, vmax=300, center=0) - plt.imshow(data, cmap=new_colormap) - plt.colorbar() - - This will create and use a colormap where the value 0 is centered, and the colormap is adjusted - to symmetrically represent deviations from this center, making it suitable for displaying anomalies - or differences from a baseline in a visually balanced manner. - - """ vmin = vmin - center @@ -1424,7 +1406,7 @@ def keep_center_colormap(cmap, vmin, vmax, center=0): dv = max(-vmin, vmax) * 2 N = int(256 * dv / (vmax - vmin)) - cont_map = cm.get_cmap(cmap, N) + cont_map = plt.get_cmap(cmap, N) newcolors = cont_map(np.linspace(0, 1, N)) beg = int((dv / 2 + vmin) * N / dv) end = N - int((dv / 2 - vmax) * N / dv)