mne.viz.plot_bem(subject=None, subjects_dir=None, orientation='coronal', slices=None, brain_surfaces=None, src=None, show=True, show_indices=True, mri='T1.mgz', show_orientation=True)[source]

Plot BEM contours on anatomical slices.


Subject name.

subjects_dirstr | None

Path to the SUBJECTS_DIR. If None, the path is obtained by using the environment variable SUBJECTS_DIR.


‘coronal’ or ‘axial’ or ‘sagittal’.

sliceslist of int

Slice indices.

brain_surfacesNone | str | list of str

One or more brain surface to plot (optional). Entries should correspond to files in the subject’s surf directory (e.g. "white").

srcNone | SourceSpaces | str

SourceSpaces instance or path to a source space to plot individual sources as scatter-plot. Sources will be shown on exactly one slice (whichever slice is closest to each source in the given orientation plane). Path can be absolute or relative to the subject’s bem folder.

Changed in version 0.20: All sources are shown on the nearest slice rather than some being omitted.


Show figure if True.


Show slice indices if True.

New in version 0.20.


The name of the MRI to use. Can be a standard FreeSurfer MRI such as 'T1.mgz', or a full path to a custom MRI file.

New in version 0.21.


Show the orientation (L/R, P/A, I/S) of the data slices.

New in version 0.21.

figinstance of matplotlib.figure.Figure

The figure.


Images are plotted in MRI voxel coordinates.

If src is not None, for a given slice index, all source points are shown that are halfway between the previous slice and the given slice, and halfway between the given slice and the next slice. For large slice decimations, this can make some source points appear outside the BEM contour, which is shown for the given slice index. For example, in the case where the single midpoint slice is used slices=[128], all source points will be shown on top of the midpoint MRI slice with the BEM boundary drawn for that slice.