mne_connectivity.viz.plot_spectrotemporal_connectivity#

mne_connectivity.viz.plot_spectrotemporal_connectivity(con, *, info=None, picks=None, selection='both', exclude='bads', combine='mean', node_aliases=None, tmin=None, tmax=None, fmin=None, fmax=None, yscale='auto', vmin=None, vmax=None, cnorm=None, cmap=None, colorbar=True, mask=None, mask_style=None, mask_cmap='Greys', mask_alpha=0.1, show=True)[source]#

Plot spectro-temporal connectivity.

Parameters:
conSpectroTemporalConnectivity

The spectro-temporal connectivity object to plot.

infomne.Info | None

The mne.Info object with information about the sensors and methods of measurement. Used to split the figures by channel types and identify bad channels. If None (default), all channels are assumed to be good 'misc' channels.

picksstr | array_like | slice | None

Channels to include in the plot. Connections involving these channels will be included, based on selection. Slices and lists of integers will be interpreted as channel indices. In lists, channel type strings (e.g., ['meg', 'eeg']) will pick channels of those types, channel name strings (e.g., ['MEG0111', 'MEG2623']) will pick the given channels. Can also be the string values 'all' to pick all channels, or 'data' to pick data channels. None (default) will pick any good channels. Note that channels in info['bads'] will be included if their names or indices are explicitly provided.

selection'seeds' | 'targets' | 'both'

What the picks parameter will be applied to. If 'seeds', only connections within the seed channels matchinng picks will be included. If 'targets', only connections within the target channels matching picks will be included. If 'both', connections will be included if either the seed or target channels match picks. Ignored if picks is None.

excludelist of str | 'bads'

Channel names to exclude from plotting. All connections involving these channels will be excluded. If 'bads' (default), channels in info['bads'] are excluded.

combine'mean' | callable() | None

How to aggregate across connections. 'mean' uses numpy.mean(). If callable(), it must operate on an array of shape (n_connections, n_freqs, n_times) and return an array of shape (n_freqs, n_times). If None, plot one figure per connection. Defaults to 'mean'.

node_aliasesdict | None

Mapping of node indices to node names. Keys should be seed or target indices found in con.indices, that is, integers for bivariate connectivity, and arrays of integers for multivariate connectivity. If None and plotting results for bivariate connectivity, node names will be taken from con.names. If None and plotting results for multivariate connectivity, node names will be generated as 'node {idx}', where idx is the order of the node in the unique set of indices, as determined by np.unique([*con.indices[0], *con.indices[1]]).

tmin, tmaxfloat | None

First and last times to plot, in seconds. If None take the first/last time in the data, respectively. Default is None.

fmin, fmaxfloat | None

First and last frequencies to plot, in Hz. If None take the first/last frequency in the data, respectively. Default is None.

yscale'linear' | 'log' | 'auto'

The scale of the y-axis (frequencies). 'linear' gives a linear y-axis. 'log' gives a log-spaced y-axis. 'auto' (default) detects if frequencies are log-spaced, and if so, sets the y-axis to 'log', otherwise is 'linear'. Default is 'auto'.

vmin, vmaxfloat | None

Lower and upper bounds of the colormap, respectively. If both entries are None and there are both positive and negative values in the data, the bounds are set at ± the maximum absolute value of the data (yielding a colormap with midpoint at 0). If both entries are None and the data is all positive or all negative, the bounds are set at the min/max of the data, respectively. Providing None for just one entry will set the corresponding boundary at the min/max of the data. Defaults to None.

cnormmatplotlib.colors.Normalize | None

How to normalize the colormap. If None (default), standard linear normalization is performed. If not None, vmin and vmax will be ignored. See Matplotlib docs for more details on colormap normalization.

cmapstr | matplotlib.colors.Colormap | None

The colormap to use for coloring the connectivity values. If a str, must be a valid Matplotlib colormap name.If None (default), 'RdBu_r' is used for data that has positive and negative values, Reds is used for data that is all positive, and Blues_r is used for data that is all negative.

colorbarbool

Whether to display a colorbar for each figure. Defaults to True.

masknumpy.ndarray | None

An array of boolean values, of the same shape as the data. Data that corresponds to False entries in the mask are plotted differently, as determined by mask_style, mask_alpha, and mask_cmap. Useful for, e.g., highlighting areas of statistical significance. Default is None, for no masking.

mask_styleNone | 'contour' | 'mask' | 'both'

How to distinguish the masked/unmasked regions of the plot. If 'contour', a line is drawn around the areas where mask is True. If 'mask', areas where mask is False will be (partially) transparent, as determined by mask_alpha. If 'both', both a contour and transparency are used. Default is None, which is silently ignored if mask is None, and is interpreted like 'both' otherwise.

mask_cmapmatplotlib.colors.Colormap | str | None

Colormap to use for masked areas of the plot. If a str, must be a valid Matplotlib colormap name. If None, cmap is used for both masked and unmasked areas. Ignored if mask is None. Default is 'Greys'.

mask_alphafloat

Relative opacity of the masked region versus the unmasked region, given as a float between 0 and 1 (0 means masked areas are not visible at all). Defaults to 0.1.

showbool

Whether to show the figure(s). Defaults to True.

Returns:
figinstance of matplotlib.figure.Figure | list of instance of matplotlib.figure.Figure

The figure(s) containing the connectivity plot(s). One figure is returned per channel types in the seeds and targets.

Notes

Plotting for multivariate connectivity is handled by treating each component of the multivariate connections as a separate connection. The names of the nodes are differentiated by the addition of the component number to the node name, e.g., 'node 0 (0)', 'node 0 (1)', ....