Skip to content

Commit a558ec6

Browse files
authored
Fix matplotlib colormap deprecation warnings for 3.11 compatibility (#269)
1 parent e982248 commit a558ec6

File tree

4 files changed

+4
-6
lines changed

4 files changed

+4
-6
lines changed

cebra/integrations/matplotlib.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1235,7 +1235,7 @@ def compare_models(
12351235

12361236
# check the color of the traces
12371237
if color is None:
1238-
cebra_map = plt.get_cmap(cmap)
1238+
cebra_map = matplotlib.colormaps.get_cmap(cmap)
12391239
colors = matplotlib.colors.ListedColormap(
12401240
cebra_map.resampled(n_models)(np.arange(n_models))).colors
12411241
else:

cebra/integrations/plotly.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ def _define_colorscale(self, cmap: str):
8787
Returns:
8888
colorscale: List of scaled colors to plot the embeddings
8989
"""
90-
colorscale = _convert_cmap2colorscale(matplotlib.cm.get_cmap(cmap))
90+
colorscale = _convert_cmap2colorscale(matplotlib.colormaps.get_cmap(cmap))
9191

9292
return colorscale
9393

setup.cfg

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,7 @@ install_requires =
3939
scipy
4040
torch>=2.4.0
4141
tqdm
42-
# NOTE(stes): Remove pin once https://github.com/AdaptiveMotorControlLab/CEBRA/issues/240
43-
# is resolved.
44-
matplotlib<3.11
42+
matplotlib
4543
requests
4644

4745
[options.extras_require]

tests/test_plotly.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131

3232
@pytest.mark.parametrize("cmap", ["viridis", "plasma", "inferno", "magma"])
3333
def test_colorscale(cmap):
34-
cmap = matplotlib.cm.get_cmap(cmap)
34+
cmap = matplotlib.colormaps.get_cmap(cmap)
3535
colorscale = cebra_plotly._convert_cmap2colorscale(cmap)
3636
assert isinstance(colorscale, list)
3737

0 commit comments

Comments
 (0)