Skip to content

Commit beaa1d0

Browse files
committed
MNT: deprecate mlab
.... except for GaussianKDE, which is needed for violinplots
1 parent f8cd2c9 commit beaa1d0

27 files changed

+12
-1329
lines changed

lib/matplotlib/mlab.py

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
"""
2-
Numerical Python functions written for compatibility with MATLAB
3-
commands with the same names. Most numerical Python functions can be found in
4-
the `NumPy`_ and `SciPy`_ libraries. What remains here is code for performing
5-
spectral computations and kernel density estimations.
2+
This module is deprecated in favour of modules that can be found in
3+
the `NumPy`_ and `SciPy`_ libraries.
64
75
.. _NumPy: https://numpy.org
86
.. _SciPy: https://www.scipy.org
@@ -58,6 +56,7 @@
5856
from matplotlib import _api, _docstring, cbook
5957

6058

59+
@_api.deprecated("3.6", alternative="np.hanning")
6160
def window_hanning(x):
6261
"""
6362
Return *x* times the Hanning (or Hann) window of len(*x*).
@@ -69,6 +68,7 @@ def window_hanning(x):
6968
return np.hanning(len(x))*x
7069

7170

71+
@_api.deprecated("3.6", alternative="")
7272
def window_none(x):
7373
"""
7474
No window function; simply return *x*.
@@ -80,6 +80,7 @@ def window_none(x):
8080
return x
8181

8282

83+
@_api.deprecated("3.6", alternative="scipy.signal.detrend")
8384
def detrend(x, key=None, axis=None):
8485
"""
8586
Return *x* with its trend removed.
@@ -129,6 +130,7 @@ def detrend(x, key=None, axis=None):
129130
f"'constant', 'mean', 'linear', or a function")
130131

131132

133+
@_api.deprecated("3.6", alternative="scipy.signal.detrend")
132134
def detrend_mean(x, axis=None):
133135
"""
134136
Return *x* minus the mean(*x*).
@@ -157,6 +159,7 @@ def detrend_mean(x, axis=None):
157159
return x - x.mean(axis, keepdims=True)
158160

159161

162+
@_api.deprecated("3.6", alternative="scipy.signal.detrend")
160163
def detrend_none(x, axis=None):
161164
"""
162165
Return *x*: no detrending.
@@ -179,6 +182,7 @@ def detrend_none(x, axis=None):
179182
return x
180183

181184

185+
@_api.deprecated("3.6", alternative="scipy.signal.detrend")
182186
def detrend_linear(y):
183187
"""
184188
Return *x* minus best fit line; 'linear' detrending.
@@ -531,6 +535,7 @@ def _single_spectrum_helper(
531535
MATLAB compatibility.""")
532536

533537

538+
@_api.deprecated("3.6", alternative="scipy.signal.psd")
534539
@_docstring.dedent_interpd
535540
def psd(x, NFFT=None, Fs=None, detrend=None, window=None,
536541
noverlap=None, pad_to=None, sides=None, scale_by_freq=None):
@@ -587,6 +592,7 @@ def psd(x, NFFT=None, Fs=None, detrend=None, window=None,
587592
return Pxx.real, freqs
588593

589594

595+
@_api.deprecated("3.6", alternative="scipy.signal.csd")
590596
@_docstring.dedent_interpd
591597
def csd(x, y, NFFT=None, Fs=None, detrend=None, window=None,
592598
noverlap=None, pad_to=None, sides=None, scale_by_freq=None):
@@ -688,7 +694,6 @@ def csd(x, y, NFFT=None, Fs=None, detrend=None, window=None,
688694
Can return the complex spectrum of segments within the signal.
689695
"""
690696

691-
692697
complex_spectrum = functools.partial(_single_spectrum_helper, "complex")
693698
complex_spectrum.__doc__ = _single_spectrum_docs.format(
694699
quantity="complex-valued frequency spectrum",
@@ -707,6 +712,7 @@ def csd(x, y, NFFT=None, Fs=None, detrend=None, window=None,
707712
**_docstring.interpd.params)
708713

709714

715+
@_api.deprecated("3.6", alternative="scipy.signal.welch")
710716
@_docstring.dedent_interpd
711717
def specgram(x, NFFT=None, Fs=None, detrend=None, window=None,
712718
noverlap=None, pad_to=None, sides=None, scale_by_freq=None,
@@ -790,6 +796,7 @@ def specgram(x, NFFT=None, Fs=None, detrend=None, window=None,
790796
return spec, freqs, t
791797

792798

799+
@_api.deprecated("3.6", alternative="scipy.signal.coherence")
793800
@_docstring.dedent_interpd
794801
def cohere(x, y, NFFT=256, Fs=2, detrend=detrend_none, window=window_hanning,
795802
noverlap=0, pad_to=None, sides='default', scale_by_freq=None):
-17 KB
Binary file not shown.
-32.8 KB
Binary file not shown.
-40.2 KB
Binary file not shown.
-53.8 KB
Binary file not shown.
-18.5 KB
Binary file not shown.
-7.96 KB
Binary file not shown.
-41.6 KB
Binary file not shown.
-15 KB
Binary file not shown.
-12.6 KB
Binary file not shown.

0 commit comments

Comments
 (0)