mne.viz.plot_evoked

mne.viz.plot_evoked(evoked, picks=None, exclude='bads', unit=True, show=True, ylim=None, xlim='tight', proj=False, hline=None, units=None, scalings=None, titles=None, axes=None, gfp=False, window_title=None, spatial_colors=False, zorder='unsorted', selectable=True, noise_cov=None, time_unit='s', sphere=None, verbose=None)[source]

Plot evoked data using butterfly plots.

Left click to a line shows the channel name. Selecting an area by clicking and holding left mouse button plots a topographic map of the painted area.

Note

If bad channels are not excluded they are shown in red.

Parameters
evokedinstance of Evoked

The evoked data.

picksstr | list | slice | None

Channels to include. Slices and lists of integers will be interpreted as channel indices. In lists, channel type strings (e.g., ['meg', 'eeg']) will pick channels of those types, channel name strings (e.g., ['MEG0111', 'MEG2623'] will pick the given channels. Can also be the string values “all” to pick all channels, or “data” to pick data channels. None (default) will pick all channels. Note that channels in info['bads'] will be included if their names or indices are explicitly provided.

excludelist of str | ‘bads’

Channels names to exclude from being shown. If ‘bads’, the bad channels are excluded.

unitbool

Scale plot with channel (SI) unit.

showbool

Show figure if True.

ylimdict | None

Y limits for plots (after scaling has been applied). e.g. ylim = dict(eeg=[-20, 20]) Valid keys are eeg, mag, grad, misc. If None, the ylim parameter for each channel equals the pyplot default.

xlim‘tight’ | tuple | None

X limits for plots.

projbool | ‘interactive’ | ‘reconstruct’

If true SSP projections are applied before display. If ‘interactive’, a check box for reversible selection of SSP projection vectors will be shown. If ‘reconstruct’, projection vectors will be applied and then M/EEG data will be reconstructed via field mapping to reduce the signal bias caused by projection.

Changed in version 0.21: Support for ‘reconstruct’ was added.

hlinelist of float | None

The values at which to show an horizontal line.

unitsdict | None

The units of the channel types used for axes labels. If None, defaults to dict(eeg='µV', grad='fT/cm', mag='fT').

scalingsdict | None

The scalings of the channel types to be applied for plotting. If None, defaults to dict(eeg=1e6, grad=1e13, mag=1e15).

titlesdict | None

The titles associated with the channels. If None, defaults to dict(eeg='EEG', grad='Gradiometers', mag='Magnetometers').

axesinstance of Axes | list | None

The axes to plot to. If list, the list must be a list of Axes of the same length as the number of channel types. If instance of Axes, there must be only one channel type plotted.

gfpbool | ‘only’

Plot the global field power (GFP) or the root mean square (RMS) of the data. For MEG data, this will plot the RMS. For EEG, it plots GFP, i.e. the standard deviation of the signal across channels. The GFP is equivalent to the RMS of an average-referenced signal.

  • True

    Plot GFP or RMS (for EEG and MEG, respectively) and traces for all channels.

  • 'only'

    Plot GFP or RMS (for EEG and MEG, respectively), and omit the traces for individual channels.

The color of the GFP/RMS trace will be green if spatial_colors=False, and black otherwise.

Changed in version 0.23: Plot GFP for EEG instead of RMS. Label RMS traces correctly as such.

window_titlestr | None

The title to put at the top of the figure.

spatial_colorsbool

If True, the lines are color coded by mapping physical sensor coordinates into color values. Spatially similar channels will have similar colors. Bad channels will be dotted. If False, the good channels are plotted black and bad channels red. Defaults to False.

zorderstr | callable()

Which channels to put in the front or back. Only matters if spatial_colors is used. If str, must be std or unsorted (defaults to unsorted). If std, data with the lowest standard deviation (weakest effects) will be put in front so that they are not obscured by those with stronger effects. If unsorted, channels are z-sorted as in the evoked instance. If callable, must take one argument: a numpy array of the same dimensionality as the evoked raw data; and return a list of unique integers corresponding to the number of channels.

New in version 0.13.0.

selectablebool

Whether to use interactive features. If True (default), it is possible to paint an area to draw topomaps. When False, the interactive features are disabled. Disabling interactive features reduces memory consumption and is useful when using axes parameter to draw multiaxes figures.

New in version 0.13.0.

noise_covinstance of Covariance | str | None

Noise covariance used to whiten the data while plotting. Whitened data channel names are shown in italic. Can be a string to load a covariance from disk. See also mne.Evoked.plot_white() for additional inspection of noise covariance properties when whitening evoked data. For data processed with SSS, the effective dependence between magnetometers and gradiometers may introduce differences in scaling, consider using mne.Evoked.plot_white().

New in version 0.16.0.

time_unitstr

The units for the time axis, can be “ms” or “s” (default).

New in version 0.16.

spherefloat | array_like | str | None

The sphere parameters to use for the cartoon head. Can be array-like of shape (4,) to give the X/Y/Z origin and radius in meters, or a single float to give the radius (origin assumed 0, 0, 0). Can also be a spherical ConductorModel, which will use the origin and radius. Can be “auto” to use a digitization-based fit. Can also be None (default) to use ‘auto’ when enough extra digitization points are available, and 0.095 otherwise. Currently the head radius does not affect plotting.

New in version 0.20.

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.

Returns
figinstance of matplotlib.figure.Figure

Figure containing the butterfly plots.

Examples using mne.viz.plot_evoked