Skip to content

Commit b3e3828

Browse files
authored
Merge pull request #991 from danibene/fix/get_cmap
[Fix] Syntax to get colormap
2 parents 8dc4e50 + ff44270 commit b3e3828

File tree

6 files changed

+6
-7
lines changed

6 files changed

+6
-7
lines changed

docs/conf.py

+1
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,7 @@ def find_version():
133133
"use_edit_page_button": True,
134134
"logo_only": True,
135135
"show_toc_level": 1,
136+
"navigation_with_keys": False,
136137
}
137138

138139

neurokit2/complexity/entropy_phase.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ def entropy_phase(signal, delay=1, k=4, show=False, **kwargs):
123123
Tx = Tx.astype(bool)
124124
Ys = np.sin(angles) * limx * np.sqrt(2)
125125
Xs = np.cos(angles) * limx * np.sqrt(2)
126-
colors = plt.get_cmap("jet")(np.linspace(0, 1, k))
126+
colors = plt.get_cmap("jet").resampled(k)
127127

128128
plt.figure()
129129
for i in range(k):

neurokit2/events/events_plot.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
# -*- coding: utf-8 -*-
2-
import matplotlib.cm
32
import matplotlib.pyplot as plt
43
import numpy as np
54
import pandas as pd
@@ -127,7 +126,7 @@ def events_plot(events, signal=None, color="red", linestyle="--"):
127126
else:
128127
# Convert color and style to list
129128
if isinstance(color, str):
130-
color_map = matplotlib.cm.get_cmap("rainbow")
129+
color_map = plt.get_cmap("rainbow")
131130
color = color_map(np.linspace(0, 1, num=len(events)))
132131
if isinstance(linestyle, str):
133132
linestyle = np.full(len(events), linestyle)

neurokit2/hrv/hrv_nonlinear.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -542,7 +542,7 @@ def _hrv_nonlinear_show(rri, rri_time=None, rri_missing=False, out={}, ax=None,
542542
kernel = scipy.stats.gaussian_kde(values)
543543
f = np.reshape(kernel(positions).T, xx.shape)
544544

545-
cmap = matplotlib.cm.get_cmap("Blues", 10)
545+
cmap = plt.get_cmap("Blues").resampled(10)
546546
ax.contourf(xx, yy, f, cmap=cmap)
547547
ax.imshow(np.rot90(f), extent=[ax1_min, ax1_max, ax2_min, ax2_max], aspect="auto")
548548

neurokit2/microstates/microstates_plot.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ def microstates_plot(microstates, segmentation=None, gfp=None, info=None, epoch=
9999
if epoch is None:
100100
epoch = (0, len(gfp))
101101

102-
cmap = plt.cm.get_cmap("plasma", n)
102+
cmap = plt.get_cmap("plasma").resampled(n)
103103
# Plot the GFP line above the area
104104
ax["GFP"].plot(
105105
times[epoch[0] : epoch[1]], gfp[epoch[0] : epoch[1]], color="black", linewidth=0.5

neurokit2/signal/signal_power.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
# -*- coding: utf-8 -*-
2-
import matplotlib.cm
32
import matplotlib.pyplot as plt
43
import numpy as np
54
import pandas as pd
@@ -193,7 +192,7 @@ def _signal_power_instant_plot(psd, out, frequency_band, ax=None):
193192
labels = [f"{i[1]}-{i[2]} Hz" for i in labels]
194193

195194
# Get cmap
196-
cmap = matplotlib.cm.get_cmap("Set1")
195+
cmap = plt.get_cmap("Set1")
197196
colors = cmap.colors
198197
colors = (
199198
colors[3],

0 commit comments

Comments
 (0)