Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Corrected default values of xextent in specgram(). Fixes Bug #7666. #7692

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Dec 29, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 14 additions & 11 deletions lib/matplotlib/axes/_axes.py
Original file line number Diff line number Diff line change
Expand Up @@ -7104,14 +7104,14 @@ def specgram(self, x, NFFT=None, Fs=None, Fc=None, detrend=None,
Parameters
----------
x : 1-D array or sequence
Array or sequence containing the data
Array or sequence containing the data.

%(Spectral)s

%(PSD)s

mode : [ 'default' | 'psd' | 'magnitude' | 'angle' | 'phase' ]
What sort of spectrum to use. Default is 'psd'. which takes
What sort of spectrum to use. Default is 'psd', which takes
the power spectral density. 'complex' returns the complex-valued
frequency spectrum. 'magnitude' returns the magnitude spectrum.
'angle' returns the phase spectrum without unwrapping. 'phase'
Expand Down Expand Up @@ -7139,10 +7139,11 @@ def specgram(self, x, NFFT=None, Fs=None, Fc=None, detrend=None,
A :class:`matplotlib.colors.Colormap` instance; if *None*, use
default determined by rc

xextent :
The image extent along the x-axis. xextent = (xmin,xmax)
The default is (0,max(bins)), where bins is the return
value from :func:`~matplotlib.mlab.specgram`
xextent : [None | (xmin, xmax)]
The image extent along the x-axis. The default sets *xmin* to the
left border of the first bin (*spectrum* column) and *xmax* to the
right border of the last bin. Note that for *noverlap>0* the width
of the bins is smaller than those of the segments.

**kwargs :
Additional kwargs are passed on to imshow which makes the
Expand All @@ -7156,14 +7157,14 @@ def specgram(self, x, NFFT=None, Fs=None, Fc=None, detrend=None,
Returns
-------
spectrum : 2-D array
columns are the periodograms of successive segments
Columns are the periodograms of successive segments.

freqs : 1-D array
The frequencies corresponding to the rows in *spectrum*
The frequencies corresponding to the rows in *spectrum*.

t : 1-D array
The times corresponding to midpoints of segments (i.e the columns
in *spectrum*)
The times corresponding to midpoints of segments (i.e., the columns
in *spectrum*).

im : instance of class :class:`~matplotlib.image.AxesImage`
The image created by imshow containing the spectrogram
Expand Down Expand Up @@ -7228,7 +7229,9 @@ def specgram(self, x, NFFT=None, Fs=None, Fc=None, detrend=None,
Z = np.flipud(Z)

if xextent is None:
xextent = 0, np.max(t)
# padding is needed for first and last segment:
pad_xextent = (NFFT-noverlap) / Fs / 2
xextent = np.min(t) - pad_xextent, np.max(t) + pad_xextent
xmin, xmax = xextent
freqs += Fc
extent = xmin, xmax, freqs[0], freqs[-1]
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified lib/matplotlib/tests/baseline_images/test_axes/specgram_freqs.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified lib/matplotlib/tests/baseline_images/test_axes/specgram_noise.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.