Note

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.

nilearn.plotting.plot_design_matrix_correlation

nilearn.plotting.plot_design_matrix_correlation(design_matrix, tri='full', cmap=<matplotlib.colors.LinearSegmentedColormap object>, output_file=None, **kwargs)[source]

Compute and plot the correlation between regressor of a design matrix.

The drift and constant regressors are omitted from the plot.

Added in version 0.11.0.

Parameters:
design_matrixpandas.DataFrame, pandas.DataFrame pathlib.Path

Design matrix whose correlation matrix you want to plot.

tri{“full”, “diag”}, default=”full”

Which triangular part of the matrix to plot:

  • "diag": Plot the lower part with the diagonal

  • "full": Plot the full matrix

cmapmatplotlib.colors.Colormap, or str, optional

The colormap to use. Either a string which is a name of a matplotlib colormap, or a matplotlib colormap object. Default=”bwr”.

This must be a diverging colormap as the correlation matrix will be centered on 0. The allowed colormaps are:

  • "bwr"

  • "RdBu_r"

  • "seismic_r"

output_filestr, or None, optional

The name of an image file to export the plot to. Valid extensions are .png, .pdf, .svg. If output_file is not None, the plot is saved to a file, and the display is closed.

kwargsextra keyword arguments, optional

Extra keyword arguments are sent to nilearn.plotting.plot_matrix

Returns:
displaymatplotlib.axes.Axes

Axes image.

Examples using nilearn.plotting.plot_design_matrix_correlation

Examples of design matrices

Examples of design matrices