@@ -7104,14 +7104,14 @@ def specgram(self, x, NFFT=None, Fs=None, Fc=None, detrend=None,
7104
7104
Parameters
7105
7105
----------
7106
7106
x : 1-D array or sequence
7107
- Array or sequence containing the data
7107
+ Array or sequence containing the data.
7108
7108
7109
7109
%(Spectral)s
7110
7110
7111
7111
%(PSD)s
7112
7112
7113
7113
mode : [ 'default' | 'psd' | 'magnitude' | 'angle' | 'phase' ]
7114
- What sort of spectrum to use. Default is 'psd'. which takes
7114
+ What sort of spectrum to use. Default is 'psd', which takes
7115
7115
the power spectral density. 'complex' returns the complex-valued
7116
7116
frequency spectrum. 'magnitude' returns the magnitude spectrum.
7117
7117
'angle' returns the phase spectrum without unwrapping. 'phase'
@@ -7139,10 +7139,11 @@ def specgram(self, x, NFFT=None, Fs=None, Fc=None, detrend=None,
7139
7139
A :class:`matplotlib.colors.Colormap` instance; if *None*, use
7140
7140
default determined by rc
7141
7141
7142
- xextent :
7143
- The image extent along the x-axis. xextent = (xmin,xmax)
7144
- The default is (0,max(bins)), where bins is the return
7145
- value from :func:`~matplotlib.mlab.specgram`
7142
+ xextent : [None | (xmin, xmax)]
7143
+ The image extent along the x-axis. The default sets *xmin* to the
7144
+ left border of the first bin (*spectrum* column) and *xmax* to the
7145
+ right border of the last bin. Note that for *noverlap>0* the width
7146
+ of the bins is smaller than those of the segments.
7146
7147
7147
7148
**kwargs :
7148
7149
Additional kwargs are passed on to imshow which makes the
@@ -7156,14 +7157,14 @@ def specgram(self, x, NFFT=None, Fs=None, Fc=None, detrend=None,
7156
7157
Returns
7157
7158
-------
7158
7159
spectrum : 2-D array
7159
- columns are the periodograms of successive segments
7160
+ Columns are the periodograms of successive segments.
7160
7161
7161
7162
freqs : 1-D array
7162
- The frequencies corresponding to the rows in *spectrum*
7163
+ The frequencies corresponding to the rows in *spectrum*.
7163
7164
7164
7165
t : 1-D array
7165
- The times corresponding to midpoints of segments (i.e the columns
7166
- in *spectrum*)
7166
+ The times corresponding to midpoints of segments (i.e., the columns
7167
+ in *spectrum*).
7167
7168
7168
7169
im : instance of class :class:`~matplotlib.image.AxesImage`
7169
7170
The image created by imshow containing the spectrogram
@@ -7228,7 +7229,9 @@ def specgram(self, x, NFFT=None, Fs=None, Fc=None, detrend=None,
7228
7229
Z = np .flipud (Z )
7229
7230
7230
7231
if xextent is None :
7231
- xextent = 0 , np .max (t )
7232
+ # padding is needed for first and last segment:
7233
+ pad_xextnt = (NFFT - noverlap ) / Fs / 2
7234
+ xextent = np .min (t ) - pad_xextnt , np .max (t ) + pad_xextnt
7232
7235
xmin , xmax = xextent
7233
7236
freqs += Fc
7234
7237
extent = xmin , xmax , freqs [0 ], freqs [- 1 ]
0 commit comments