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

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. If dict, keys must be of type str.

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 | callable | None

If not None and evokeds is a [list/dict] of lists, a shaded confidence interval is drawn around the individual time series. If float, a percentile bootstrap method is used to estimate the confidence interval and this value determines the CI width. E.g., if this value is .95 (the default), the 95% confidence interval is drawn. If a callable, it must take as its single argument an array (observations x times) and return the upper and lower confidence bands. If None, no confidence band is plotted.

truncate_yaxis : bool | str

If True, the left y axis spine is truncated to reduce visual clutter. If ‘max_ticks’, the spine is truncated at the minimum and maximum ticks. Else, it is truncated to half the max absolute value, rounded to .25. Defaults to False.

truncate_xaxis : bool

If True, the x axis is truncated to span from the first to the last. xtick. 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.

show_sensors: bool | int | None

If not False, channel locations are plotted on a small head circle. If an int, the position of the axes (forwarded to mpl_toolkits.axes_grid1.inset_locator.inset_axes). If None, defaults to True if gfp is False, else to False.

show_legend : bool | int

If not False, show a legend. If int, the position of the axes (forwarded to mpl_toolkits.axes_grid1.inset_locator.inset_axes).

axes : None | matplotlib.axes.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