mne_denoise.viz.plot_component_spectrogram#

mne_denoise.viz.plot_component_spectrogram(component_data, sfreq, freqs=None, fmax=50.0, n_cycles=None, title='Component Spectrogram', ax=None, show=True, fname=None)[source]#

Plot a time-frequency power view for one component.

Parameters:
  • component_data (ndarray, shape (n_times,) or (n_epochs, n_times)) – Single-component time series or repeated epochs of one component.

  • sfreq (float) – Sampling frequency.

  • freqs (ndarray | None) – Frequencies to compute. If None, frequencies are generated from 1 Hz to fmax (capped at Nyquist).

  • fmax (float | None) – Upper frequency bound used when freqs is None. Defaults to 50 Hz to preserve prior behavior.

  • n_cycles (float | ndarray | None) – Number of cycles for multitaper estimation.

  • title (str) – Axes title.

  • ax (matplotlib.axes.Axes | None) – Optional target axes. If None, a new themed figure is created.

  • show (bool, default=True) – If True, show the figure.

  • fname (path-like | None) – Optional output path used to save the figure.

Returns:

fig – Figure handle.

Return type:

matplotlib.figure.Figure

Raises:

ValueError – If component_data is not 1D/2D, or if fmax is not positive when freqs is None.

Notes

A 1D input is treated as one pseudo-epoch. A 2D input is interpreted as (n_epochs, n_times) and averaged across epochs in power space.

Examples

>>> from mne_denoise.viz import plot_component_spectrogram
>>> fig = plot_component_spectrogram(
...     component_data, sfreq=250.0, fmax=80, show=False
... )