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.

3.11.3. nistats.reporting.plot_contrast_matrix

nistats.reporting.plot_contrast_matrix(contrast_def, design_matrix, colorbar=False, ax=None, output_file=None)

Creates plot for contrast definition.

Parameters
contrast_defstr or array of shape (n_col) or list of (string or

array of shape (n_col))

where n_col is the number of columns of the design matrix, (one array per run). If only one array is provided when there are several runs, it will be assumed that the same contrast is desired for all runs. The string can be a formula compatible with pandas.DataFrame.eval. Basically one can use the name of the conditions as they appear in the design matrix of the fitted model combined with operators +- and combined with numbers with operators +-*/.

design_matrix: pandas DataFrame
colorbar: Boolean, optional (default False)

Include a colorbar in the contrast matrix plot.

ax: matplotlib Axes object, optional (default None)

Directory where plotted figures will be stored.

output_file: string 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.

Returns
Plot Axes object