@@ -7097,14 +7097,14 @@ def specgram(self, x, NFFT=None, Fs=None, Fc=None, detrend=None,
7097
7097
Parameters
7098
7098
----------
7099
7099
x : 1-D array or sequence
7100
- Array or sequence containing the data
7100
+ Array or sequence containing the data.
7101
7101
7102
7102
%(Spectral)s
7103
7103
7104
7104
%(PSD)s
7105
7105
7106
7106
mode : [ 'default' | 'psd' | 'magnitude' | 'angle' | 'phase' ]
7107
- What sort of spectrum to use. Default is 'psd'. which takes
7107
+ What sort of spectrum to use. Default is 'psd', which takes
7108
7108
the power spectral density. 'complex' returns the complex-valued
7109
7109
frequency spectrum. 'magnitude' returns the magnitude spectrum.
7110
7110
'angle' returns the phase spectrum without unwrapping. 'phase'
@@ -7132,10 +7132,11 @@ def specgram(self, x, NFFT=None, Fs=None, Fc=None, detrend=None,
7132
7132
A :class:`matplotlib.colors.Colormap` instance; if *None*, use
7133
7133
default determined by rc
7134
7134
7135
- xextent :
7136
- The image extent along the x-axis. xextent = (xmin,xmax)
7137
- The default is (0,max(bins)), where bins is the return
7138
- value from :func:`~matplotlib.mlab.specgram`
7135
+ xextent : [None | (xmin, xmax)]
7136
+ The image extent along the x-axis. The default sets *xmin* to the
7137
+ left border of the first bin (*spectrum* column) and *xmax* to the
7138
+ right border of the last bin. Note that for *noverlap>0* the width
7139
+ of the bins is smaller than those of the segments.
7139
7140
7140
7141
**kwargs :
7141
7142
Additional kwargs are passed on to imshow which makes the
@@ -7149,14 +7150,14 @@ def specgram(self, x, NFFT=None, Fs=None, Fc=None, detrend=None,
7149
7150
Returns
7150
7151
-------
7151
7152
spectrum : 2-D array
7152
- columns are the periodograms of successive segments
7153
+ Columns are the periodograms of successive segments.
7153
7154
7154
7155
freqs : 1-D array
7155
- The frequencies corresponding to the rows in *spectrum*
7156
+ The frequencies corresponding to the rows in *spectrum*.
7156
7157
7157
7158
t : 1-D array
7158
- The times corresponding to midpoints of segments (i.e the columns
7159
- in *spectrum*)
7159
+ The times corresponding to midpoints of segments (i.e., the columns
7160
+ in *spectrum*).
7160
7161
7161
7162
im : instance of class :class:`~matplotlib.image.AxesImage`
7162
7163
The image created by imshow containing the spectrogram
@@ -7221,7 +7222,9 @@ def specgram(self, x, NFFT=None, Fs=None, Fc=None, detrend=None,
7221
7222
Z = np .flipud (Z )
7222
7223
7223
7224
if xextent is None :
7224
- xextent = 0 , np .amax (t )
7225
+ # padding is needed for first and last segment:
7226
+ pad_xextent = (NFFT - noverlap ) / Fs / 2
7227
+ xextent = np .min (t ) - pad_xextent , np .max (t ) + pad_xextent
7225
7228
xmin , xmax = xextent
7226
7229
freqs += Fc
7227
7230
extent = xmin , xmax , freqs [0 ], freqs [- 1 ]
0 commit comments