spectrogram_plot¶
MATLAB equivalent:
sidSpectrogramPlot
spectrogram_plot ¶
Spectrogram colour map plot.
spectrogram_plot ¶
spectrogram_plot(result: SpectrogramResult, *, frequency_scale: str = 'linear', channel: int = 0, clim: tuple | None = None, ax=None) -> dict
Spectrogram colour map plot.
This is the Python port of sidSpectrogramPlot.m.
Plots the spectrogram as a time-frequency colour map with power in dB.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
result
|
SpectrogramResult
|
Result struct returned by :func: |
required |
frequency_scale
|
str
|
|
'linear'
|
channel
|
int
|
Zero-based channel index for multi-channel data. Default is
|
0
|
clim
|
tuple of (float, float) or None
|
Colour axis limits |
None
|
ax
|
matplotlib Axes or None
|
Existing axes to plot into. If |
None
|
Returns:
| Type | Description |
|---|---|
dict
|
Dictionary with the following keys:
|
Raises:
| Type | Description |
|---|---|
SidError
|
If result is not a |
SidError
|
If channel is out of range (code: |
Examples:
>>> import numpy as np
>>> import sid
>>> Fs = 1000; Ts = 1 / Fs; N = 5000
>>> t = np.arange(N) * Ts
>>> x = np.cos(2 * np.pi * (50 + 100 * t / t[-1]) * t)
>>> result = sid.spectrogram(x, window_length=256, sample_time=Ts)
>>> h = sid.spectrogram_plot(result)
Notes
Specification: SPEC.md S7.5 -- Visualization
The channel parameter is 0-indexed (Python convention), unlike
MATLAB's 1-indexed Channel option.
See Also
sid.spectrogram : Compute a spectrogram. sid.map_plot : Time-frequency map for freq_map results.
Changelog
2026-04-09 : First version (Python port) by Pedro Lourenco.