How to make the line of the head outline in a topoplot thicker?

Is there a way to change the thickness of the circle that makes up the head in a topo plot ( mne.viz.plot_topomap)?

Not directly. 2 options here: either you edit MNE’s code plotting the topomap to your liking; or you retrieve the figure/axis/matplotlib object created and then further edit it.

For instance with the colormap property:

from mne.datasets import sample
from mne.io import read_raw_fif
from mne.viz import plot_topomap


fname = sample.data_path() / "MEG" / "sample" / "sample_audvis_raw.fif"
raw = read_raw_fif(fname, preload=False)
raw.pick("eeg").crop(0, 1).load_data()
ax, _ = plot_topomap(raw.get_data()[:, 0], raw.info)
ax.set_cmap("Blues")

I’m not sure exactly where in the matplotlib axis or figure (accessible with ax.figure) you’ll find the circle/head artists, but the idea is to find them and edit the properties.

Mathieu

1 Like

picking up from the last line of @mscheltienne’s code:

img, _ = plot_topomap(raw.get_data()[:, 0], raw.info)
for line in img.axes.lines:
    line.set_linewidth(4)
3 Likes

Thank you so much, this is exactly what I was looking for.