niworkflows.viz package

niworkflows.viz.plot_carpet(data, segments=None, cmap=None, tr=None, detrend=True, subplot=None, title=None, output_file=None, size=(900, 1200), sort_rows='ward', drop_trs=0, legend=True)[source]

Plot an image representation of voxel intensities across time.

This kind of plot is known as “carpet plot” or “Power plot”. See Jonathan Power Neuroimage 2017 Jul 1; 154:150-158.

Parameters:
  • data (N x T numpy.array) – The functional data to be plotted (N sampling locations by T timepoints).

  • segments (dict, optional) – A mapping between segment labels (e.g., “Left Cortex”) and list of indexes in the data array.

  • cmap (colormap) – Overrides the generation of an automated colormap.

  • tr (float , optional) – Specify the TR, if specified it uses this value. If left as None, # of frames is plotted instead of time.

  • detrend (bool, optional) – Detrend and standardize the data prior to plotting.

  • subplot (matplotlib subplot, optional) – Subplot to plot figure on.

  • title (string, optional) – The title displayed on the figure.

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

  • size (tuple) – Maximum number of samples to plot (voxels, timepoints)

  • sort_rows (str or False or None) – Apply a clustering algorithm to reorganize the rows of the carpet. "", False, and None skip clustering sorting. "linkage" uses linkage hierarchical clustering scipy.cluster.hierarchy.linkage. Any other value that Python evaluates to True will use the default clustering, which is sklearn.cluster.ward_tree.

Submodules