diff --git a/lib/matplotlib/mlab.py b/lib/matplotlib/mlab.py index 194420816175..3664e869814e 100644 --- a/lib/matplotlib/mlab.py +++ b/lib/matplotlib/mlab.py @@ -720,8 +720,8 @@ def _spectral_helper(x, y=None, NFFT=None, Fs=None, detrend_func=None, if not same_data: # if same_data is False, mode must be 'psd' resultY = stride_windows(y, NFFT, noverlap) - resultY = apply_window(resultY, window, axis=0) resultY = detrend(resultY, detrend_func, axis=0) + resultY = apply_window(resultY, window, axis=0) resultY = np.fft.fft(resultY, n=pad_to, axis=0)[:numFreqs, :] result = np.conj(result) * resultY elif mode == 'psd':