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
orFalse
orNone
) – Apply a clustering algorithm to reorganize the rows of the carpet.""
,False
, andNone
skip clustering sorting."linkage"
uses linkage hierarchical clusteringscipy.cluster.hierarchy.linkage
. Any other value that Python evaluates toTrue
will use the default clustering, which issklearn.cluster.ward_tree
.