gastropy.plot_tfr

Contents

gastropy.plot_tfr#

gastropy.plot_tfr(freqs, times, power, band=None, vmin=None, vmax=None, cmap='viridis', ax=None)[source]#

Plot a time-frequency representation as a heatmap.

Displays Morlet wavelet power (or any 2D time-frequency array) with time on the x-axis and frequency on the y-axis.

Parameters:
  • freqs (array_like) – Frequency values in Hz (length n_freqs).

  • times (array_like) – Time values in seconds (length n_times).

  • power (array_like) – Power matrix, shape (n_freqs, n_times).

  • band (GastricBand, optional) – If provided, draws horizontal dashed lines at the band edges.

  • vmin (float, optional) – Minimum value for the color scale.

  • vmax (float, optional) – Maximum value for the color scale.

  • cmap (str, optional) – Matplotlib colormap name. Default is "viridis".

  • ax (matplotlib.axes.Axes, optional) – Axes to plot on. If None, creates a new figure.

Returns:

  • fig (matplotlib.figure.Figure)

  • ax (matplotlib.axes.Axes)

See also

gastropy.timefreq.morlet_tfr

Compute Morlet wavelet TFR.

Examples

>>> from gastropy.timefreq import morlet_tfr
>>> from gastropy.viz import plot_tfr
>>> freqs, times, power = morlet_tfr(sig, sfreq=10.0,
...     freqs=np.arange(0.02, 0.1, 0.005))
>>> fig, ax = plot_tfr(freqs, times, power)