# mne.viz.plot_epochs_image¶

mne.viz.plot_epochs_image(epochs, picks=None, sigma=0.0, vmin=None, vmax=None, colorbar=True, order=None, show=True, units=None, scalings=None, cmap=None, fig=None, axes=None, overlay_times=None, combine=None, group_by=None, evoked=True, ts_args={}, title=None)[source]

Plot Event Related Potential / Fields image.

Parameters
epochsinstance of Epochs

The epochs.

picks

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 good data channels. If None and group_by is also None, only the first five good channels are plotted.

sigmafloat

The standard deviation of the Gaussian smoothing to apply along the epoch axis to apply in the image. If 0., no smoothing is applied. Defaults to 0.

vmin

The min value in the image (and the ER[P/F]). The unit is uV for EEG channels, fT for magnetometers and fT/cm for gradiometers. If vmin is None and multiple plots are returned, the limit is equalized within channel types. Hint: to specify the lower limit of the data, use vmin=lambda data: data.min().

vmax

The max value in the image (and the ER[P/F]). The unit is uV for EEG channels, fT for magnetometers and fT/cm for gradiometers. If vmin is None and multiple plots are returned, the limit is equalized within channel types.

colorbarbool

Display or not a colorbar.

order

If not None, order is used to reorder the epochs on the y-axis of the image. If it’s an array of int it should be of length the number of good epochs. If it’s a callable the arguments passed are the times vector and the data as 2d array (data.shape[1] == len(times).

showbool

Show figure if True.

units

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

scalings

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

cmapNone | colormap | (colormap, bool) | ‘interactive’

Colormap. If tuple, the first value indicates the colormap to use and the second value is a boolean defining interactivity. In interactive mode the colors are adjustable by clicking and dragging the colorbar with left and right mouse button. Left mouse button moves the scale up and down and right mouse button adjusts the range. Hitting space bar resets the scale. Up and down arrows can be used to change the colormap. If ‘interactive’, translates to (‘RdBu_r’, True). If None, “RdBu_r” is used, unless the data is all positive, in which case “Reds” is used.

fig

Figure instance to draw the image to. Figure must contain two axes for drawing the single trials and evoked responses. If None a new figure is created. Defaults to None.

axes

List of axes instances to draw the image, erp and colorbar to. Must be of length three if colorbar is True (with the last list element being the colorbar axes) or two if colorbar is False. If both fig and axes are passed, an error is raised. If group_by is a dict, this cannot be a list, but it can be a dict of lists of axes, with the keys matching those of group_by. In that case, the provided axes will be used for the corresponding groups. Defaults to None.

overlay_timesarray_like, shape (n_epochs,) | None

If not None the parameter is interpreted as time instants in seconds and is added to the image. It is typically useful to display reaction times. Note that it is defined with respect to the order of epochs such that overlay_times[0] corresponds to epochs[0].

combine

If None, return one figure per pick. If not None, aggregate over channels via the indicated method. If str, must be one of “mean”, “median”, “std” or “gfp”, in which case the mean, the median, the standard deviation or the GFP over channels are plotted. array (n_epochs, n_times). If callable, it must accept one positional input, the data in the format (n_epochs, n_channels, n_times). It must return an array (n_epochs, n_times). For example:

combine = lambda data: np.median(data, axis=1)


Defaults to None if picks are provided, otherwise ‘gfp’.

group_by

If not None, combining happens over channel groups defined by this parameter. If str, must be “type”, in which case one figure per channel type is returned (combining within channel types). If a dict, the values must be picks and one figure will be returned for each entry, aggregating over the corresponding pick groups; keys will become plot titles. This is useful for e.g. ROIs. Each entry must contain only one channel type. For example:

group_by=dict(Left_ROI=[1, 2, 3, 4], Right_ROI=[5, 6, 7, 8])


If not None, combine must not be None. Defaults to None if picks are provided, otherwise ‘type’.

evokedbool

Draw the ER[P/F] below the image or not.

ts_argsdict

Arguments passed to a call to mne.viz.plot_compare_evoked to style the evoked plot below the image. Defaults to an empty dictionary, meaning plot_compare_evokeds will be called with default parameters (yaxis truncation will be turned off, and inversion of the y axis via invert_y=True will raise an error).

title

If str, will be plotted as figure title. Else, the channels will be indicated.

Returns
figs

One figure per channel displayed.