cmp.cli.showmatrix_gpickle module

This module defines the showmatrix_gpickle script that loads and displays a connectivity matrix.

cmp.cli.showmatrix_gpickle.main()[source]

Main function that load and display the specified connectivity matrix.

Returns

exit_code

An exit code given to sys.exit() that can be:

  • ’0’ in case of successful completion

  • ’1’ in case of an error

Return type

{0, 1}

cmp.cli.showmatrix_gpickle.plot_connectivity_circle(con, node_names, indices=None, n_lines=None, node_angles=None, node_width=None, node_colors=None, facecolor='black', textcolor='white', node_edgecolor='black', linewidth=1.5, colormap='hot', vmin=None, vmax=None, colorbar=True, title=None, colorbar_size=0.2, colorbar_pos=(- 0.15, - 0.05), fontsize_title=12, fontsize_names=10, fontsize_colorbar=10, padding=4.0, fig=None, subplot=111, interactive=True, node_linewidth=2.0, show=True)[source]

Visualize connectivity as a circular graph.

Note: This code is based on the circle graph example by Nicolas P. Rougier http://www.labri.fr/perso/nrougier/coding/.

Parameters
  • con (numpy.array) – Connectivity scores. Can be a square matrix, or a 1D array. If a 1D array is provided, “indices” has to be used to define the connection indices.

  • node_names (list of str) – Node names. The order corresponds to the order in con.

  • indices (tuple of arrays | None) – Two arrays with indices of connections for which the connections strenghts are defined in con. Only needed if con is a 1D array.

  • n_lines (int | None) – If not None, only the n_lines strongest connections (strength=abs(con)) are drawn.

  • node_angles (array, shape=(len(node_names,)) | None) – Array with node positions in degrees. If None, the nodes are equally spaced on the circle. See mne.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_colors (list of tuples | list of str) – 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) – Colormap to use for coloring the connections.

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

  • colorbar (bool) – Display a colorbar or not.

  • title (str) – The figure title.

  • colorbar_size (float) – Size of the colorbar.

  • colorbar_pos (2-tuple) – 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.

  • fig (None | instance of matplotlib.pyplot.Figure) – The figure to use. If None, a new figure with the specified background color will be created.

  • subplot (int | 3-tuple) – Location of the subplot when creating figures with multiple plots. E.g. 121 or (1, 2, 1) for 1 row, 2 columns, plot 1. See matplotlib.pyplot.subplot.

  • interactive (bool) – When enabled, left-click on a node to show only connections to that node. Right-click shows all connections.

  • node_linewidth (float) – Line with for nodes.

  • show (bool) – Show figure if True.

Returns

  • fig (instance of matplotlib.pyplot.Figure) – The figure handle.

  • axes (instance of matplotlib.axes.PolarAxesSubplot) – The subplot handle.