Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 160fb26

Browse filesBrowse files
efiringtacaswell
authored andcommitted
Partial backport of pull request matplotlib#7845 from vollbier/specgram_overlap_err
Fixed bug with default parameters NFFT and noverlap in specgram() Did not backport the warning.
1 parent 4fbaeab commit 160fb26
Copy full SHA for 160fb26

File tree

Expand file treeCollapse file tree

2 files changed

+8
-2
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+8
-2
lines changed

‎lib/matplotlib/axes/_axes.py

Copy file name to clipboardExpand all lines: lib/matplotlib/axes/_axes.py
+5-1Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7190,8 +7190,12 @@ def specgram(self, x, NFFT=None, Fs=None, Fc=None, detrend=None,
71907190
if not self._hold:
71917191
self.cla()
71927192

7193+
if NFFT is None:
7194+
NFFT = 256 # same default as in mlab.specgram()
71937195
if Fc is None:
7194-
Fc = 0
7196+
Fc = 0 # same default as in mlab._spectral_helper()
7197+
if noverlap is None:
7198+
noverlap = 128 # same default as in mlab.specgram()
71957199

71967200
if mode == 'complex':
71977201
raise ValueError('Cannot plot a complex specgram')

‎lib/matplotlib/mlab.py

Copy file name to clipboardExpand all lines: lib/matplotlib/mlab.py
+3-1Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1275,7 +1275,9 @@ def specgram(x, NFFT=None, Fs=None, detrend=None, window=None,
12751275
12761276
"""
12771277
if noverlap is None:
1278-
noverlap = 128
1278+
noverlap = 128 # default in _spectral_helper() is noverlap = 0
1279+
if NFFT is None:
1280+
NFFT = 256 # same default as in _spectral_helper()
12791281

12801282
spec, freqs, t = _spectral_helper(x=x, y=None, NFFT=NFFT, Fs=Fs,
12811283
detrend_func=detrend, window=window,

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.