mne.viz.plot_compare_evokeds(evokeds, picks=[], gfp=False, colors=None, linestyles=['-'], styles=None, vlines=[0.0], ci=0.95, truncate_yaxis=True, ylim={}, invert_y=False, axes=None, title=None, show=True)

Plot evoked time courses for one or multiple channels and conditions

This function is useful for comparing ER[P/F]s at a specific location. It plots Evoked data or, if supplied with a list/dict of lists of evoked instances, grand averages plus confidence intervals.


evokeds : instance of mne.Evoked | list | dict

If a single evoked instance, it is plotted as a time series. If a dict whose values are Evoked objects, the contents are plotted as single time series each and the keys are used as condition labels. If a list of Evokeds, the contents are plotted with indices as labels. If a [dict/list] of lists, the unweighted mean is plotted as a time series and the parametric confidence interval is plotted as a shaded area. All instances must have the same shape - channel numbers, time points etc.

picks : int | list of int

If int or list of int, the indices of the sensors to average and plot. Must all be of the same channel type. If the selected channels are gradiometers, the corresponding pairs will be selected. If multiple channel types are selected, one figure will be returned for each channel type. If an empty list, gfp will be set to True, and the Global Field Power plotted.

gfp : bool

If True, the channel type wise GFP is plotted. If picks is an empty list (default), this is set to True.

colors : list | dict | None

If a list, will be sequentially used for line colors. If a dict, can map evoked keys or ‘/’-separated (HED) tags to conditions. For example, if evokeds is a dict with the keys “Aud/L”, “Aud/R”, “Vis/L”, “Vis/R”, colors can be dict(Aud=’r’, Vis=’b’) to map both Aud/L and Aud/R to the color red and both Visual conditions to blue. If None (default), a sequence of desaturated colors is used.

linestyles : list | dict

If a list, will be sequentially and repeatedly used for evoked plot linestyles. If a dict, can map the evoked keys or ‘/’-separated (HED) tags to conditions. For example, if evokeds is a dict with the keys “Aud/L”, “Aud/R”, “Vis/L”, “Vis/R”, linestyles can be dict(L=’–’, R=’-‘) to map both Aud/L and Vis/L to dashed lines and both Right-side conditions to straight lines.

styles : dict | None

If a dict, keys must map to evoked keys or conditions, and values must be a dict of legal inputs to matplotlib.pyplot.plot. These parameters will be passed to the line plot call of the corresponding condition, overriding defaults. E.g., if evokeds is a dict with the keys “Aud/L”, “Aud/R”, “Vis/L”, “Vis/R”, styles can be {“Aud/L”:{“linewidth”:1}} to set the linewidth for “Aud/L” to 1. Note that HED (‘/’-separated) tags are not supported.

vlines : list of int

A list of integers corresponding to the positions, in seconds, at which to plot dashed vertical lines.

ci : float | None

If not None and evokeds is a [list/dict] of lists, a confidence interval is drawn around the individual time series. This value determines the CI width. E.g., if this value is .95 (the default), the 95% parametric confidence interval is drawn. If None, no shaded confidence band is plotted.

truncate_yaxis : bool

If True, the left y axis is truncated to half the max value and rounded to .25 to reduce visual clutter. Defaults to True.

ylim : dict | None

ylim 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.

invert_y : bool

If True, negative values are plotted up (as is sometimes done for ERPs out of tradition). Defaults to False.

axes : None | matplotlib.pyplot.axes instance | list of axes

What axes to plot to. If None, a new axes is created. When plotting multiple channel types, can also be a list of axes, one per channel type.

title : None | str

If str, will be plotted as figure title. If None, the channel names will be shown.

show : bool

If True, show the figure.


fig : Figure | list of Figures

The figure(s) in which the plot is drawn.

Examples using mne.viz.plot_compare_evokeds