how to plot tfr topomap of epochs in local area like the attribute 'extrapolate' in evoked_plot _topomap

If you have a question or issue with MNE-Python, please include the following info:

  • MNE-Python version: 0.23
  • operating system: spyder
    In the evoked_plot_topomap function, we can plot amplitude value in the local area around certain montages, shown as the following example:
    but how to plot the power topomap of epochs like this?

Hello @QYR_HME and welcome to the forum!

I cannot help you with this specific question, but I’m tagging @cbrnr who might have an idea!

Best wishes,

You can plot values from raw numpy arrays with mne.viz.plot_topomap. So first you can get spectral power in a numpy array and then plot the desired frequency in this way:

psd, freq = mne.time_frequency.psd_welch(epochs)
# the psd array has shape epochs x channels x frequencies, so we average
# the epochs dimension
psd_average = psd.mean(axis=0)

# lets say we want to plot 10 Hz
plot_freq = 10
# we find the index of this frequency
freq_idx = (np.abs(freq - plot_freq)).argmin()
# we plot the topography of power for the chosen frequency
mne.viz.plot_topomap(psd_average[:, freq_idx],