brainmass.viz.plot_connectivity

brainmass.viz.plot_connectivity#

brainmass.viz.plot_connectivity(matrix, *, labels=None, ax=None, cmap='viridis', colorbar=True, **kwargs)[source]#

Plot a connectivity (or any square) matrix as a heatmap.

Parameters:
  • matrix (array_like or brainunit.Quantity) – (N, N) matrix. Units are stripped for plotting.

  • labels (sequence of str, optional) – Tick labels for both axes.

  • ax (matplotlib.axes.Axes, optional) – Axes to draw on. A new figure/axes is created when None.

  • cmap (str, optional) – Colormap name. Default 'viridis'.

  • colorbar (bool, optional) – Whether to attach a colorbar. Default True.

  • **kwargs – Forwarded to matplotlib.axes.Axes.imshow().

Returns:

The axes drawn on.

Return type:

matplotlib.axes.Axes

See also

plot_functional_connectivity

connectivity derived from a time series.

Examples

>>> import brainmass
>>> conn = brainmass.datasets.load_dataset('example_connectome')
>>> ax = brainmass.viz.plot_connectivity(conn.weights)
>>> len(ax.images)
1