@@ -7097,14 +7097,14 @@ def specgram(self, x, NFFT=None, Fs=None, Fc=None, detrend=None,
70977097 Parameters
70987098 ----------
70997099 x : 1-D array or sequence
7100- Array or sequence containing the data
7100+ Array or sequence containing the data.
71017101
71027102 %(Spectral)s
71037103
71047104 %(PSD)s
71057105
71067106 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
71087108 the power spectral density. 'complex' returns the complex-valued
71097109 frequency spectrum. 'magnitude' returns the magnitude spectrum.
71107110 'angle' returns the phase spectrum without unwrapping. 'phase'
@@ -7132,10 +7132,11 @@ def specgram(self, x, NFFT=None, Fs=None, Fc=None, detrend=None,
71327132 A :class:`matplotlib.colors.Colormap` instance; if *None*, use
71337133 default determined by rc
71347134
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.
71397140
71407141 **kwargs :
71417142 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,
71497150 Returns
71507151 -------
71517152 spectrum : 2-D array
7152- columns are the periodograms of successive segments
7153+ Columns are the periodograms of successive segments.
71537154
71547155 freqs : 1-D array
7155- The frequencies corresponding to the rows in *spectrum*
7156+ The frequencies corresponding to the rows in *spectrum*.
71567157
71577158 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*).
71607161
71617162 im : instance of class :class:`~matplotlib.image.AxesImage`
71627163 The image created by imshow containing the spectrogram
@@ -7221,7 +7222,9 @@ def specgram(self, x, NFFT=None, Fs=None, Fc=None, detrend=None,
72217222 Z = np .flipud (Z )
72227223
72237224 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
72257228 xmin , xmax = xextent
72267229 freqs += Fc
72277230 extent = xmin , xmax , freqs [0 ], freqs [- 1 ]
0 commit comments