This page is a reference documentation. It only explains the function signature, and not how to use it. Please refer to the user guide for the big picture.

7.10.8. nilearn.plotting.plot_matrix

nilearn.plotting.plot_matrix(mat, title=None, labels=None, figure=None, axes=None, colorbar=True, cmap=<matplotlib.colors.LinearSegmentedColormap object at 0x7f676cc74cd0>, tri='full', auto_fit=True, grid=False, reorder=False, **kwargs)

Plot the given matrix.

mat2-D numpy array

Matrix to be plotted.

titlestring or None, optional

A text to add in the upper left corner.

labelslist, ndarray of strings, empty list, False, or None, optional

The label of each row and column. Needs to be the same length as rows/columns of mat. If False, None, or an empty list, no labels are plotted.

figurefigure instance, figsize tuple, or None

Sets the figure used. This argument can be either an existing figure, or a pair (width, height) that gives the size of a newly-created figure. Specifying both axes and figure is not allowed.

axesNone or Axes, optional

Axes instance to be plotted on. Creates a new one if None. Specifying both axes and figure is not allowed.

colorbarboolean, optional

If True, an integrated colorbar is added.

cmapmatplotlib colormap, optional

The colormap for the matrix. Default is RdBu_r.

tri{‘lower’, ‘diag’, ‘full’}, optional

Which triangular part of the matrix to plot: ‘lower’ is the lower part, ‘diag’ is the lower including diagonal, and ‘full’ is the full matrix.

auto_fitboolean, optional

If auto_fit is True, the axes are dimensioned to give room for the labels. This assumes that the labels are resting against the bottom and left edges of the figure.

gridcolor or False, optional

If not False, a grid is plotted to separate rows and columns using the given color.

reorderboolean or {‘single’, ‘complete’, ‘average’}, optional

If not False, reorders the matrix into blocks of clusters. Accepted linkage options for the clustering are ‘single’, ‘complete’, and ‘average’. True defaults to average linkage.


This option is only available with SciPy >= 1.0.0.

New in version 0.4.1.

kwargsextra keyword arguments

Extra keyword arguments are sent to pylab.imshow

displayinstance of matplotlib

Axes image.