Repository: librosa/librosa

Issue:
Matplotlib colormap deprecation warnings in librosa/display.py
**Describe the bug**

```matplotlib=3.7.0``` deprecated ```matplotlib.cm.get_cmap(name=None, lut=None)``` per https://matplotlib.org/stable/api/cm_api.html#matplotlib.cm.get_cmap. This is causing ```librosa/display``` to throw warnings on downstream ```pytest```. This deprecation will be entirely removed in ```matplotlib=3.9.0```.

**To Reproduce**

Execute a test from ```tests/test_display.py``` (with --disable-pytest-warnings temporarily removed from ```setup.cfg```):

```bash
pytest tests/test_display.py::test_double_chroma
```


**Expected behavior**

Test should pass without warnings.


**Screenshots**

```bash
./librosa/librosa/display.py:859: MatplotlibDeprecationWarning: The get_cmap function was deprecated in Matplotlib 3.7 and will be removed two minor releases later. Use ``matplotlib.colormaps[name]`` or ``matplotlib.colormaps.get_cmap(obj)`` instead.
    return mcm.get_cmap(cmap_seq)
```

**Software versions**

```python
>>> import platform; print(platform.platform())
Linux-5.15.133.1-microsoft-standard-WSL2-x86_64-with-glibc2.35

>>> import sys; print("Python", sys.version)
Python 3.9.18 | packaged by conda-forge | (main, Aug 30 2023, 03:49:32) 
[GCC 12.3.0]

>>> import numpy; print("NumPy", numpy.__version__)
NumPy 1.26.0

>>> import scipy; print("SciPy", scipy.__version__)
SciPy 1.11.3

>>> import librosa; print("librosa", librosa.__version__)
librosa 0.10.1

>>> librosa.show_versions()
INSTALLED VERSIONS
------------------
python: 3.9.18 | packaged by conda-forge | (main, Aug 30 2023, 03:49:32) 
[GCC 12.3.0]

librosa: 0.10.1

audioread: 3.0.1
numpy: 1.26.0
scipy: 1.11.3
sklearn: 1.3.2
joblib: 1.3.2
decorator: 5.1.1
numba: 0.58.1
soundfile: 0.12.1
pooch: v1.8.0
soxr: 0.3.7
typing_extensions: installed, no version number available
lazy_loader: installed, no version number available
msgpack: 1.0.6

numpydoc: None
sphinx: None
sphinx_rtd_theme: None
matplotlib: 3.8.1
sphinx_multiversion: None
sphinx_gallery: None
mir_eval: None
ipython: None
sphinxcontrib.rsvgconverter: None
pytest: 7.4.3
pytest_mpl: 0.16.1
pytest_cov: 4.1.0
samplerate: 0.1.0
resampy: 0.4.2
presets: None
packaging: 23.2
```

**Additional context**
Nil.



Discussion:

Resolving patch:
diff --git a/librosa/display.py b/librosa/display.py
--- a/librosa/display.py
+++ b/librosa/display.py
@@ -41,7 +41,7 @@
 import warnings
 
 import numpy as np
-import matplotlib.cm as mcm
+from matplotlib import colormaps as mcm
 import matplotlib.axes as mplaxes
 import matplotlib.ticker as mplticker
 import matplotlib.pyplot as plt
@@ -844,7 +844,7 @@ def cmap(
     data = np.atleast_1d(data)
 
     if data.dtype == "bool":
-        return mcm.get_cmap(cmap_bool, lut=2)
+        return mcm[cmap_bool]
 
     data = data[np.isfinite(data)]
 
@@ -856,9 +856,9 @@ def cmap(
     min_val, max_val = np.percentile(data, [min_p, max_p])
 
     if min_val >= 0 or max_val <= 0:
-        return mcm.get_cmap(cmap_seq)
+        return mcm[cmap_seq]
 
-    return mcm.get_cmap(cmap_div)
+    return mcm[cmap_div]
 
 
 def __envelope(x, hop):


Test patch: