mne.viz.plot_tfr_topomap#

mne.viz.plot_tfr_topomap(tfr, tmin=None, tmax=None, fmin=None, fmax=None, ch_type=None, baseline=None, mode='mean', vmin=None, vmax=None, cmap=None, sensors=True, colorbar=True, unit=None, res=64, size=2, cbar_fmt='%1.1e', show_names=False, title=None, axes=None, show=True, outlines='head', contours=6, sphere=None)[source]#

Plot topographic maps of specific time-frequency intervals of TFR data.

Parameters:
tfrAverageTFR

The AverageTFR object.

tminNone | float

The first time instant to display. If None the first time point available is used.

tmaxNone | float

The last time instant to display. If None the last time point available is used.

fminNone | float

The first frequency to display. If None the first frequency available is used.

fmaxNone | float

The last frequency to display. If None the last frequency available is used.

ch_type‘mag’ | ‘grad’ | ‘planar1’ | ‘planar2’ | ‘eeg’ | None

The channel type to plot. For ‘grad’, the gradiometers are collected in pairs and the mean for each pair is plotted. If None, then channels are chosen in the order given above.

baselinetuple or list of length 2

The time interval to apply rescaling / baseline correction. If None do not apply it. If baseline is (a, b) the interval is between “a (s)” and “b (s)”. If a is None the beginning of the data is used and if b is None then b is set to the end of the interval. If baseline is equal to (None, None) the whole time interval is used.

mode‘mean’ | ‘ratio’ | ‘logratio’ | ‘percent’ | ‘zscore’ | ‘zlogratio’ | None

Perform baseline correction by

  • subtracting the mean baseline power (‘mean’)

  • dividing by the mean baseline power (‘ratio’)

  • dividing by the mean baseline power and taking the log (‘logratio’)

  • subtracting the mean baseline power followed by dividing by the mean baseline power (‘percent’)

  • subtracting the mean baseline power and dividing by the standard deviation of the baseline power (‘zscore’)

  • dividing by the mean baseline power, taking the log, and dividing by the standard deviation of the baseline power (‘zlogratio’)

If None no baseline correction is applied.

vmin, vmaxfloat | callable() | None

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

cmapmatplotlib colormap | (colormap, bool) | ‘interactive’ | None

Colormap 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. 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).

sensorsbool | str

Add markers for sensor locations to the plot. Accepts matplotlib plot format string (e.g., ‘r+’). If True (default), circles will be used.

colorbarbool

Plot a colorbar.

unitstr | None

The unit of the channel type used for colorbar labels.

resint

The resolution of the topomap image (n pixels along each side).

sizefloat

Side length per topomap in inches (only applies when plotting multiple topomaps at a time).

cbar_fmtstr

String format for colorbar values.

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

titlestr | None

Plot title. If None (default), no title is displayed.

axesinstance of Axes | None

The axes to plot to. If None the axes is defined automatically.

showbool

Show figure if True.

outlines‘head’ | ‘skirt’ | dict | None

The 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’.

contoursint | array of float

The 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. If colorbar=True, the ticks in colorbar correspond to the contour levels. Defaults to 6.

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

Returns:
figmatplotlib.figure.Figure

The figure containing the topography.