LFP/ECP Plotting API
bmtool.bmplot.lfp.plot_spectrogram(sxx_xarray, remove_aperiodic=None, log_power=False, plt_range=None, clr_freq_range=None, pad=0.03, ax=None, vmin=None, vmax=None)
Plot a power spectrogram with optional aperiodic removal and frequency-based coloring.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
sxx_xarray
|
array - like
|
Spectrogram data as an xarray DataArray with PSD values. |
required |
remove_aperiodic
|
optional
|
FOOOF model object for aperiodic subtraction. If None, raw spectrum is displayed. |
None
|
log_power
|
bool or str
|
If True or 'dB', convert power to log scale. Default is False. |
False
|
plt_range
|
tuple of float
|
Frequency range to display as (f_min, f_max). If None, displays full range. |
None
|
clr_freq_range
|
tuple of float
|
Frequency range to use for determining color limits. If None, uses full range. |
None
|
pad
|
float
|
Padding for colorbar. Default is 0.03. |
0.03
|
ax
|
Axes
|
Axes to plot on. If None, creates a new figure and axes. |
None
|
vmin
|
float
|
Minimum value for colorbar scaling. If None, computed from data. |
None
|
vmax
|
float
|
Maximum value for colorbar scaling. If None, computed from data. |
None
|
Returns:
| Type | Description |
|---|---|
Figure
|
The figure object containing the spectrogram. |
Examples:
>>> fig = plot_spectrogram(
... sxx_xarray, log_power='dB',
... plt_range=(10, 100), clr_freq_range=(20, 50)
... )
Source code in bmtool/bmplot/lfp.py
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 | |