From b68d1280d75326c1b1eba2a9455b369c00174223 Mon Sep 17 00:00:00 2001 From: Daniel Garcia Moreno Date: Wed, 24 Jul 2024 12:03:31 +0200 Subject: [PATCH] Use get_cmap from matplotlib.colormaps matplotlib.cm.get_cmap is deprecated, the documentation recommends to use matplotlib.colormaps.get_cmap instead. https://matplotlib.org/stable/api/cm_api.html#matplotlib.cm.get_cmap --- examples/Examples.ipynb | 2 +- pythreejs/pythreejs.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/Examples.ipynb b/examples/Examples.ipynb index 893e26a3..401a1e2e 100644 --- a/examples/Examples.ipynb +++ b/examples/Examples.ipynb @@ -178,7 +178,7 @@ "import matplotlib.pyplot as plt\n", "from skimage import img_as_ubyte \n", "\n", - "jet = matplotlib.cm.get_cmap('jet')\n", + "jet = matplotlib.colormaps.get_cmap('jet')\n", "\n", "np.random.seed(int(1)) # start random number generator\n", "n = int(5) # starting points\n", diff --git a/pythreejs/pythreejs.py b/pythreejs/pythreejs.py index 9119ea18..f2705748 100644 --- a/pythreejs/pythreejs.py +++ b/pythreejs/pythreejs.py @@ -231,7 +231,7 @@ def make_text(text, position=(0, 0, 0), height=1): def height_texture(z, colormap='viridis'): """Create a texture corresponding to the heights in z and the given colormap.""" - from matplotlib import cm + from matplotlib import colormaps as cm from skimage import img_as_ubyte colormap = cm.get_cmap(colormap)