Skip to content

Commit 9f9bf4f

Browse files
MNT: Fix deprectation error in CI (#866)
matplotlib.cm.get_cmap → matplotlib.colormaps matplotlib/matplotlib#23668 Fixes #865.
1 parent 1d96855 commit 9f9bf4f

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

niworkflows/viz/plots.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
import pandas as pd
2828

2929
import matplotlib.pyplot as plt
30+
from matplotlib import colormaps
3031
from matplotlib import gridspec as mgs
3132
import matplotlib.cm as cm
3233
from matplotlib.colors import Normalize
@@ -200,9 +201,9 @@ def plot_carpet(
200201
legend = False
201202

202203
if cmap is None:
203-
colors = cm.get_cmap("tab10").colors
204+
colors = colormaps["tab10"].colors
204205
elif cmap == "paired":
205-
colors = list(cm.get_cmap("Paired").colors)
206+
colors = list(colormaps["Paired"].colors)
206207
colors[0], colors[1] = colors[1], colors[0]
207208
colors[2], colors[7] = colors[7], colors[2]
208209

@@ -397,7 +398,7 @@ def spikesplot(
397398
ntsteps = ts_z.shape[1]
398399

399400
# Load a colormap
400-
my_cmap = cm.get_cmap(cmap)
401+
my_cmap = colormaps[cmap]
401402
norm = Normalize(vmin=0, vmax=float(nslices - 1))
402403
colors = [my_cmap(norm(sl)) for sl in range(nslices)]
403404

@@ -525,7 +526,7 @@ def spikesplot_cb(position, cmap="viridis", fig=None):
525526
cax = fig.add_axes(position)
526527
cb = ColorbarBase(
527528
cax,
528-
cmap=cm.get_cmap(cmap),
529+
cmap=colormaps[cmap],
529530
spacing="proportional",
530531
orientation="horizontal",
531532
drawedges=False,

0 commit comments

Comments
 (0)