mne.viz.plot_epochs

mne.viz.plot_epochs(epochs, picks=None, scalings=None, n_epochs=20, n_channels=20, title=None, show=True, block=False)

Visualize epochs

Bad epochs can be marked with a left click on top of the epoch. Bad channels can be selected by clicking the channel name on the left side of the main axes. Calling this function drops all the selected bad epochs as well as bad epochs marked beforehand with rejection parameters.

Parameters:

epochs : instance of Epochs

The epochs object

picks : array-like of int | None

Channels to be included. If None only good data channels are used. Defaults to None

scalings : dict | None

Scale factors for the traces. If None, defaults to:

dict(mag=1e-12, grad=4e-11, eeg=20e-6, eog=150e-6, ecg=5e-4,
     emg=1e-3, ref_meg=1e-12, misc=1e-3, stim=1, resp=1, chpi=1e-4)

n_epochs : int

The number of epochs per view. Defaults to 20.

n_channels : int

The number of channels per view. Defaults to 20.

title : str | None

The title of the window. If None, epochs name will be displayed. Defaults to None.

show : bool

Show figure if True. Defaults to True

block : bool

Whether to halt program execution until the figure is closed. Useful for rejecting bad trials on the fly by clicking on an epoch. Defaults to False.

Returns:

fig : Instance of matplotlib.figure.Figure

The figure.

Notes

The arrow keys (up/down/left/right) can be used to navigate between channels and epochs and the scaling can be adjusted with - and + (or =) keys, but this depends on the backend matplotlib is configured to use (e.g., mpl.use(TkAgg) should work). Full screen mode can be toggled with f11 key. The amount of epochs and channels per view can be adjusted with home/end and page down/page up keys. Butterfly plot can be toggled with b key. Right mouse click adds a vertical line to the plot.