colorbar in plot_topomap

Hi,

How do I add a color bar when plotting a eeg based topomap using mne.viz.plot_topomap?
I dont see the colorbar argument - mne.viz.plot_topomap — MNE 1.0.3 documentation

Hello, are you sure you want to use mne.viz.plot_topomap() and not the plot_topomap() method of Evoked? What kind of data are you planning to plot?

@richard ,

I have the average power values for eeg channel on an excel sheet. I am using those values to plot the topomap. And both mne.viz.plot_topomap() and not the plot_topomap() give me the error - got an unexpected keyword argument 'colorbar

Evoked.plot_topomap() should not throw this error.

mne.viz.plot_topomap() returns the image created by Matplotlib, which you can use to create a colorbar. You’d do something like the following (untested):

fig, ax = plt.subplots()
img, _ = mne.viz.plot_topomap(..., axes=ax)
cbar = plt.colorbar(
    ax=ax, shrink=0.75, orientation='vertical', mappable=img,
)
cbar.set_label('Average power')
1 Like