Plot topographic maps of specific time points of evoked data.
EvokedThe Evoked object.
float | array of float | “auto” | “peaks” | “interactive”The time point(s) to plot. If “auto”, the number of axes determines
the amount of time point(s). If axes is also None, at most 10
topographies will be shown with a regular time spacing between the
first and last time instant. If “peaks”, finds time points
automatically by checking for local maxima in global field power. If
“interactive”, the time can be set interactively at run-time by using a
slider.
NoneThe channel type to plot. For ‘grad’, the gradiometers are collected in pairs and the RMS for each pair is plotted. If None, then channels are chosen in the order given above.
float | callable() | NoneLower and upper bounds of the colormap, in the same units as the data.
If vmin and vmax are both None, they are set at ± the
maximum absolute value of the data (yielding a colormap with midpoint
at 0). If only one of vmin, vmax is None, will use
min(data) or max(data), respectively. If callable, should
accept a NumPy array of data and return a
float.
NoneColormap to use. 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 (zoom). The mouse scroll can also be used to adjust the range. Hitting space bar resets the range. Up and down arrows can be used to change the colormap. If None (default), ‘Reds’ is used for all positive data, otherwise defaults to ‘RdBu_r’. If ‘interactive’, translates to (None, True).
Warning
Interactive mode works smoothly only for a small amount of topomaps. Interactive mode is disabled by default for more than 2 topomaps.
strAdd markers for sensor locations to the plot. Accepts matplotlib plot format string (e.g., ‘r+’ for red plusses). If True (default), circles will be used.
Plot a colorbar in the rightmost column of the figure.
dict | float | NoneThe scalings of the channel types to be applied for plotting.
If None, defaults to dict(eeg=1e6, grad=1e13, mag=1e15).
dict | str | NoneThe unit of the channel type used for colorbar label. If scale is None the unit is automatically determined.
intThe resolution of the topomap image (n pixels along each side).
floatSide length per topomap in inches.
strString format for colorbar values.
strThe units for the time axis, can be “ms” or “s” (default).
New in version 0.16.
str | NoneString format for topomap values. Defaults (None) to “%01d ms” if
time_unit='ms', “%0.3f s” if time_unit='s', and
“%g” otherwise. Can be an empty string to omit the time label.
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.
Show the figure if True.
callable()If True, show channel names on top of the map. If a callable is
passed, channel names will be formatted using the callable; e.g., to
delete the prefix ‘MEG ‘ from all channel names, pass the function
lambda x: x.replace('MEG ', ''). If mask is not None, only
significant sensors will be shown.
str | NoneThe title of the generated figure. If None (default), no title is
displayed.
ndarray of bool, shape (n_channels, n_times) | NoneArray indicating channel-time combinations to highlight with a distinct
plotting style (useful for, e.g. marking which channels at which times a statistical test of the data reaches significance). Array elements set to True will be plotted
with the parameters given in mask_params. Defaults to None,
equivalent to an array of all False elements.
dict | NoneAdditional plotting parameters for plotting significant sensors. Default (None) equals:
dict(marker='o', markerfacecolor='w', markeredgecolor='k',
linewidth=0, markersize=4)
dict | NoneThe outlines to be drawn. If ‘head’, the default head scheme will be drawn. If ‘skirt’ the head scheme will be drawn, but sensors are allowed to be plotted outside of the head circle. If dict, each key refers to a tuple of x and y positions, the values in ‘mask_pos’ will serve as image mask. Alternatively, a matplotlib patch object can be passed for advanced masking options, either directly or as a function that returns patches (required for multi-axis plots). If None, nothing will be drawn. Defaults to ‘head’.
int | array of floatThe number of contour lines to draw. If 0, no contours will be drawn. When an integer, matplotlib ticker locator is used to find suitable values for the contour thresholds (may sometimes be inaccurate, use array for accuracy). If an array, the values represent the levels for the contours. The values are in µV for EEG, fT for magnetometers and fT/m for gradiometers. If colorbar=True, the ticks in colorbar correspond to the contour levels. Defaults to 6.
strThe image interpolation to be used. Options are 'cubic' (default)
to use scipy.interpolate.CloughTocher2DInterpolator,
'nearest' to use scipy.spatial.Voronoi or
'linear' to use scipy.interpolate.LinearNDInterpolator.
float | array-like of float, shape (n_times,) | NoneThe time window (in seconds) around a given time point to be used for
averaging. For example, 0.2 would translate into a time window that
starts 0.1 s before and ends 0.1 s after the given time point. If the
time window exceeds the duration of the data, it will be clipped.
Different time windows (one per time point) can be provided by
passing an array-like object (e.g., [0.1, 0.2, 0.3]). If
None (default), no averaging will take place.
Changed in version 1.1: Support for array-like input.
Axes | list | NoneThe axes to plot to. If list, the list must be a list of Axes of the
same length as times (unless times is None). If instance of
Axes, times must be a float or a list of one float.
Defaults to None.
strOptions:
'box'Extrapolate to four points placed to form a square encompassing all data points, where each side of the square is three times the range of the data in the respective dimension.
'local' (default for MEG sensors)Extrapolate only to nearby points (approximately to points closer than median inter-electrode distance). This will also set the mask to be polygonal based on the convex hull of the sensors.
'head' (default for non-MEG sensors)Extrapolate out to the edges of the clipping circle. This will be on the head circle when the sensors are contained within the head circle, but it can extend beyond the head when sensors are plotted outside the head circle.
Changed in version 0.21:
The default was changed to 'local' for MEG sensors.
'local' was changed to use a convex hull mask
'head' was changed to extrapolate out to the clipping circle.
New in version 0.18.
float | array-like | instance of ConductorModel | None | ‘auto’ | ‘eeglab’The sphere parameters to use for the head outline. Can be array-like of
shape (4,) to give the X/Y/Z origin and radius in meters, or a single float
to give just the radius (origin assumed 0, 0, 0). Can also be an instance
of a spherical ConductorModel to use the origin and
radius from that object. If 'auto' the sphere is fit to digitization
points. If 'eeglab' the head circle is defined by EEG electrodes
'Fpz', 'Oz', 'T7', and 'T8' (if 'Fpz' is not present,
it will be approximated from the coordinates of 'Oz'). None (the
default) is equivalent to 'auto' when enough extra digitization points
are available, and (0, 0, 0, 0.095) otherwise. Currently the head radius
does not affect plotting.
New in version 0.20.
Changed in version 1.1: Added 'eeglab' option.
float | ‘mean’Value to extrapolate to on the topomap borders. If 'mean' (default),
then each extrapolated point has the average value of its neighbours.
New in version 0.20.
int | ‘auto’The number of rows of topographies to plot. Defaults to 1. If ‘auto’, obtains the number of rows depending on the amount of times to plot and the number of cols. Not valid when times == ‘interactive’.
New in version 0.20.
int | ‘auto’The number of columns of topographies to plot. If ‘auto’ (default), obtains the number of columns depending on the amount of times to plot and the number of rows. Not valid when times == ‘interactive’.
New in version 0.20.
matplotlib.figure.FigureThe figure.
Notes
When existing axes are provided and colorbar=True, note that the
colorbar scale will only accurately reflect topomaps that are generated in
the same call as the colorbar. Note also that the colorbar will not be
resized automatically when axes are provided; use Matplotlib’s
axes.set_position() method or
gridspec
interface to adjust the colorbar size yourself.