mne.viz.plot_alignment(info=None, trans=None, subject=None, subjects_dir=None, surfaces='auto', coord_frame='head', meg=None, eeg='original', fwd=None, dig=False, ecog=True, src=None, mri_fiducials=False, bem=None, seeg=True, fnirs=True, show_axes=False, dbs=True, fig=None, interaction='trackball', verbose=None)[source]

Plot head, sensor, and source space alignment in 3D.

infodict | None

The measurement info. If None (default), no sensor information will be shown.

transstr | dict | instance of Transform | None

If str, the path to the head<->MRI transform *-trans.fif file produced during coregistration. Can also be 'fsaverage' to use the built-in fsaverage transformation. If trans is None, an identity matrix is assumed.

Changed in version 0.19: Support for ‘fsaverage’ argument.

subjectstr | None

The subject name corresponding to FreeSurfer environment variable SUBJECT. Can be omitted if src is provided.

subjects_dirstr | None

The path to the FreeSurfer subjects reconstructions. It corresponds to FreeSurfer environment variable SUBJECTS_DIR.

surfacesstr | list | dict

Surfaces to plot. Supported values:

  • scalp: one of ‘head’, ‘outer_skin’ (alias for ‘head’), ‘head-dense’, or ‘seghead’ (alias for ‘head-dense’)

  • skull: ‘outer_skull’, ‘inner_skull’, ‘brain’ (alias for ‘inner_skull’)

  • brain: one of ‘pial’, ‘white’, ‘inflated’, or ‘brain’ (alias for ‘pial’).

Can be dict to specify alpha values for each surface. Use None to specify default value. Specified values must be between 0 and 1. for example:

surfaces=dict(brain=0.4, outer_skull=0.6, head=None)

Defaults to ‘auto’, which will look for a head surface and plot it if found.


For single layer BEMs it is recommended to use ‘brain’.


Coordinate frame to use, ‘head’, ‘meg’, or ‘mri’.

megstr | list | bool | None

Can be “helmet”, “sensors” or “ref” to show the MEG helmet, sensors or reference sensors respectively, or a combination like ('helmet', 'sensors') (same as None, default). True translates to ('helmet', 'sensors', 'ref').

eegbool | str | list

String options are:

  • “original” (default; equivalent to True)

    Shows EEG sensors using their digitized locations (after transformation to the chosen coord_frame)

  • “projected”

    The EEG locations projected onto the scalp, as is done in forward modeling

Can also be a list of these options, or an empty list ([], equivalent of False).

fwdinstance of Forward

The forward solution. If present, the orientations of the dipoles present in the forward solution are displayed.

digbool | ‘fiducials’

If True, plot the digitization points; ‘fiducials’ to plot fiducial points only.


If True (default), show ECoG sensors.

srcinstance of SourceSpaces | None

If not None, also plot the source space points.

mri_fiducialsbool | str

Plot MRI fiducials (default False). If True, look for a file with the canonical name (bem/{subject}-fiducials.fif). If str, it can be 'estimated' to use mne.coreg.get_mni_fiducials(), otherwise it should provide the full path to the fiducials file.

New in version 0.22: Support for 'estimated'.

bemlist of dict | instance of ConductorModel | None

Can be either the BEM surfaces (list of dict), a BEM solution or a sphere model. If None, we first try loading '$SUBJECTS_DIR/$SUBJECT/bem/$SUBJECT-$SOURCE.fif', and then look for '$SUBJECT*$SOURCE.fif' in the same directory. For 'outer_skin', the subjects bem and bem/flash folders are searched. Defaults to None.


If True (default), show sEEG electrodes.

fnirsstr | list | bool | None

Can be “channels”, “pairs”, “detectors”, and/or “sources” to show the fNIRS channel locations, optode locations, or line between source-detector pairs, or a combination like ('pairs', 'channels'). True translates to ('pairs',).

New in version 0.20.


If True (default False), coordinate frame axis indicators will be shown:

  • head in pink.

  • MRI in gray (if trans is not None).

  • MEG in blue (if MEG sensors are present).

New in version 0.16.


If True (default), show DBS (deep brain stimulation) electrodes.

figmayavi.mlab.Figure | None

Mayavi Scene in which to plot the alignment. If None, creates a new 600x600 pixel figure with black background.

New in version 0.16.


Can be “trackball” (default) or “terrain”, i.e. a turntable-style camera.

New in version 0.16.

verbosebool, str, int, or None

If not None, override default verbose level (see mne.verbose() and Logging documentation for more). If used, it should be passed as a keyword-argument only.

figinstance of mayavi.mlab.Figure

The mayavi figure.

See also



This function serves the purpose of checking the validity of the many different steps of source reconstruction:

  • Transform matrix (keywords trans, meg and mri_fiducials),

  • BEM surfaces (keywords bem and surfaces),

  • sphere conductor model (keywords bem and surfaces) and

  • source space (keywords surfaces and src).

New in version 0.15.