mne_connectivity.viz.plot_temporal_connectivity#

mne_connectivity.viz.plot_temporal_connectivity(con, *, info=None, picks=None, selection='both', exclude='bads', combine=None, ci='sd', tmin=None, tmax=None, node_aliases=None, colors='auto', cmap='turbo', highlight=None, interactive=True, show=True)[source]#

Plot temporal connectivity as line plots, with circle plot overviews.

Parameters:
conTemporalConnectivity

The 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_times) and return an array of shape (n_times,). If None, plot each connection individually. Defaults to None.

cifloat | 'sd' | 'range' | None

Type of confidence band drawn around the aggregated data when combine is not None. If 'sd' (default) the band spans ±1 the standard deviation across connections. If 'range' the band spans the range across connections at each bin. If a float, it indicates the (bootstrapped) confidence interval to display, and must satisfy 0 < ci <= 100. If None, no band is drawn.

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.

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

colors'auto' | 'global' | 'relative'

How to color the connections. If 'global', the same colormap is used across all connections. This is recommended if the connectivity indices do not correspond to a full or symmetric matrix. If 'relative', the connections for each channel span the full colormap. This is recommended if the connectivity indices correspond to a full or symmetric matrix. If 'auto' (default), the coloring is set to 'relative' if the connectivity indices correspond to a lower-triangular matrix and interactive is True, or 'global' otherwise.

cmapstr | matplotlib.colors.Colormap

Colormap to use for coloring the connections. If a str, must be a recognised Matplotlib colormap name. Default is 'turbo'.

highlightarray_like of float, shape (2,) | array_like of float, shape (n, 2) | None

Segments of the data to highlight by means of a light-yellow background color. The data periods to highlight must be specified as array-like objects in the form of (start, end) in the units of the data. Multiple periods can be specified by passing an array-like object of individual periods (e.g., for 3 periods, the shape of the passed object would be (3, 2). If None (default), no highlighting is applied.

interactivebool

Whether to make the plot interactive. This enables functionality like clicking on a connection to show its name. Defaults to True.

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

The circle plot acts as an overview of the channels and their connections in the line plot. If interactive is True, left-clicking on a channel in the circle plot will show the connections only for that channel (the exact behaviour is determined by selection). Right-click to return to the original view. The circle plot is not shown if the plotted connections correspond to only a single node in the figure.

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)', ....