Plotting head in helmet from a trans fileΒΆ

In this example, the head is shown in the MEG helmet along with the EEG electrodes in MRI coordinate system. This allows assessing the MEG <-> MRI coregistration quality.

# Author: Mainak Jas <>
# License: BSD (3-clause)

from mne import read_evokeds
from mne.datasets import sample
from mne.viz import plot_trans


data_path = sample.data_path()

data_path = sample.data_path()
subjects_dir = data_path + '/subjects'
evoked_fname = data_path + '/MEG/sample/sample_audvis-ave.fif'
trans_fname = data_path + '/MEG/sample/sample_audvis_raw-trans.fif'

condition = 'Left Auditory'
evoked = read_evokeds(evoked_fname, condition=condition, baseline=(-0.2, 0.0))
plot_trans(, trans_fname, subject='sample', dig=True,

Total running time of the script: (0 minutes 0.419 seconds)

Download Python source code: