MCPcopy
hub / github.com/matplotlib/matplotlib / specgram

Method specgram

lib/matplotlib/axes/_axes.py:8513–8670  ·  view source on GitHub ↗

Plot a spectrogram. Compute and plot a spectrogram of data in *x*. Data are split into *NFFT* length segments and the spectrum of each section is computed. The windowing function *window* is applied to each segment, and the amount of overlap of each segmen

(self, x, NFFT=None, Fs=None, Fc=None, detrend=None,
                 window=None, noverlap=None,
                 cmap=None, xextent=None, pad_to=None, sides=None,
                 scale_by_freq=None, mode=None, scale=None,
                 vmin=None, vmax=None, **kwargs)

Source from the content-addressed store, hash-verified

8511 @_preprocess_data(replace_names=["x"])
8512 @_docstring.interpd
8513 def specgram(self, x, NFFT=None, Fs=None, Fc=None, detrend=None,
8514 window=None, noverlap=None,
8515 cmap=None, xextent=None, pad_to=None, sides=None,
8516 scale_by_freq=None, mode=None, scale=None,
8517 vmin=None, vmax=None, **kwargs):
8518 """
8519 Plot a spectrogram.
8520
8521 Compute and plot a spectrogram of data in *x*. Data are split into
8522 *NFFT* length segments and the spectrum of each section is
8523 computed. The windowing function *window* is applied to each
8524 segment, and the amount of overlap of each segment is
8525 specified with *noverlap*. The spectrogram is plotted as a colormap
8526 (using imshow).
8527
8528 Parameters
8529 ----------
8530 x : 1-D array or sequence
8531 Array or sequence containing the data.
8532
8533 %(Spectral)s
8534
8535 %(PSD)s
8536
8537 mode : {'default', 'psd', 'magnitude', 'angle', 'phase'}
8538 What sort of spectrum to use. Default is 'psd', which takes the
8539 power spectral density. 'magnitude' returns the magnitude
8540 spectrum. 'angle' returns the phase spectrum without unwrapping.
8541 'phase' returns the phase spectrum with unwrapping.
8542
8543 noverlap : int, default: 128
8544 The number of points of overlap between blocks.
8545
8546 scale : {'default', 'linear', 'dB'}
8547 The scaling of the values in the *spec*. 'linear' is no scaling.
8548 'dB' returns the values in dB scale. When *mode* is 'psd',
8549 this is dB power (10 * log10). Otherwise, this is dB amplitude
8550 (20 * log10). 'default' is 'dB' if *mode* is 'psd' or
8551 'magnitude' and 'linear' otherwise. This must be 'linear'
8552 if *mode* is 'angle' or 'phase'.
8553
8554 Fc : int, default: 0
8555 The center frequency of *x*, which offsets the x extents of the
8556 plot to reflect the frequency range used when a signal is acquired
8557 and then filtered and downsampled to baseband.
8558
8559 cmap : `.Colormap`, default: :rc:`image.cmap`
8560
8561 xextent : *None* or (xmin, xmax)
8562 The image extent along the x-axis. The default sets *xmin* to the
8563 left border of the first bin (*spectrum* column) and *xmax* to the
8564 right border of the last bin. Note that for *noverlap>0* the width
8565 of the bins is smaller than those of the segments.
8566
8567 data : indexable object, optional
8568 DATA_PARAMETER_PLACEHOLDER
8569
8570 vmin, vmax : float, optional

Callers 12

specgramFunction · 0.80
test_specgramMethod · 0.80
test_specgramFunction · 0.80
test_specgram_magnitudeFunction · 0.80
test_specgram_angleFunction · 0.80
test_specgram_fs_noneFunction · 0.80
specgram_demo.pyFile · 0.80

Calls 4

imshowMethod · 0.95
axisMethod · 0.95
minMethod · 0.80
maxMethod · 0.80

Tested by 10

test_specgramMethod · 0.64
test_specgramFunction · 0.64
test_specgram_magnitudeFunction · 0.64
test_specgram_angleFunction · 0.64
test_specgram_fs_noneFunction · 0.64