mne_connectivity.viz.plot_circle_connectivity#
- mne_connectivity.viz.plot_circle_connectivity(con, *, info=None, picks=None, selection='both', exclude='bads', node_aliases=None, n_lines=None, node_angles=None, node_width=None, node_height=1.0, node_colors=None, facecolor='black', textcolor='white', node_edgecolor='black', linewidth=1.5, colormap=None, vmin=None, vmax=None, colorbar=True, title=None, colorbar_size=0.2, colorbar_pos=(-0.3, 0.1), fontsize_title=12, fontsize_names=8, fontsize_colorbar=8, padding=6.0, ax=None, interactive=True, node_linewidth=2.0, show=True)[source]#
Visualize connectivity as a circular graph.
- Parameters:
- con
Connectivity The connectivity data to plot. Multivariate connectivity is not supported.
Changed in version 1.0: Arrays are no longer supported, so the
indicesparameter was removed.- info
mne.Info|None The
mne.Infoobject with information about the sensors and methods of measurement. Used to identify bad channels. IfNone(default), all channels are assumed to be good'misc'channels.Added in version 1.0.
- picks
str| 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 ininfo['bads']will be included if their names or indices are explicitly provided.Added in version 1.0.
- selection
'seeds'|'targets'|'both' What the
picksparameter will be applied to. If'seeds', only connections within the seed channels matchinngpickswill be included. If'targets', only connections within the target channels matchingpickswill be included. If'both', connections will be included if either the seed or target channels matchpicks. Ignored ifpicksisNone.Added in version 1.0.
- exclude
listofstr|'bads' Channel names to exclude from plotting. All connections involving these channels will be excluded. If
'bads'(default), channels ininfo['bads']are excluded.Added in version 1.0.
- node_aliases
dict|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. IfNoneand plotting results for bivariate connectivity, node names will be taken fromcon.names. IfNoneand plotting results for multivariate connectivity, node names will be generated as'node {idx}', whereidxis the order of the node in the unique set of indices, as determined bynp.unique([*con.indices[0], *con.indices[1]]).Added in version 1.0: Replaces the
node_namesparameter.- n_lines
int|None If not
None, only then_linesstrongest connections (strength=abs(con)) are drawn.- node_angles
array, shape (n_nodes,) |None Array with node positions in degrees, in the order of
con.names. IfNone, the nodes are equally spaced on the circle. Seemne.viz.circular_layout().- node_width
float|None Width of each node in degrees. If
None, the minimum angle between any two nodes is used as the width.- node_height
float The relative height of the colored bar labeling each node. Default 1.0 is the standard height.
- node_colors
listoftuple|listofstr List with the color to use for each node. If fewer colors than nodes are provided, the colors will be repeated. Any color supported by matplotlib can be used, e.g., RGBA tuples, named colors.
- facecolor
str Color to use for background. See
matplotlib.colors.- textcolor
str Color to use for text. See
matplotlib.colors.- node_edgecolor
str Color to use for lines around nodes. See
matplotlib.colors.- linewidth
float Line width to use for connections.
- colormap
str| instance ofmatplotlib.colors.Colormap|None Colormap to use for coloring the connections. If
None(default), a diverging colormap is used when the drawn connections have both positive and negative values, or whenvminandvmaxspan zero:"berlin"on a darkfacecolor("RdBu_r"with matplotlib < 3.10) and"RdBu_r"on a light one. Otherwise,"hot"is used.Changed in version 1.0: The default changed from
"hot"toNone.- vmin
float|None Minimum value for colormap. If
None, it is determined automatically.- vmax
float|None Maximum value for colormap. If
None, it is determined automatically. If bothvminandvmaxareNoneand the drawn connections have both positive and negative values, the limits are symmetric around zero.Changed in version 1.0: Automatic limits for data with both signs are symmetric around zero.
- colorbarbool
Display a colorbar or not.
- title
str The figure title.
- colorbar_size
float Size of the colorbar.
- colorbar_pos
tuple, shape (2,) Position of the colorbar.
- fontsize_title
int Font size to use for title.
- fontsize_names
int Font size to use for node names.
- fontsize_colorbar
int Font size to use for colorbar.
- padding
float Space to add around figure to accommodate long labels.
- axinstance of
matplotlib.projections.polar.PolarAxes|None The axes to use to plot the connectivity circle.
- interactivebool
When enabled, left-click on a node to show only connections to that node. Right-click shows all connections.
- node_linewidth
float Line width for nodes.
- showbool
Show figure if
True.
- con
- Returns:
- figinstance of
matplotlib.figure.Figure The figure handle.
- axinstance of
matplotlib.projections.polar.PolarAxes The subplot handle.
- figinstance of
Notes
This code is based on a circle graph example by Nicolas P. Rougier.
By default,
matplotlib.pyplot.savefig()does not takefacecolorinto account when saving, even if set when a figure is generated. This can be addressed via, e.g.:>>> fig.savefig(fname_fig, facecolor='black')
If
facecoloris not set viamatplotlib.pyplot.savefig(), the figure labels, title, and legend may be cut off in the output figure.Changed in version 1.0: Renamed from
plot_connectivity_circle.