neurocaps.analysis.CAP.caps2plot#
- CAP.caps2plot(output_dir=None, suffix_title=None, suffix_filename=None, plot_options='outer_product', visual_scope='regions', show_figs=True, subplots=False, **kwargs)[source]#
Generate Heatmaps and Outer Product Plots for CAPs.
Plot CAPs as heatmaps or outer products at the node or region/network levels. This function produces a
seaborn.heatmapfor each CAP. Note, if groups were given when theCAPclass was initialized, separate plots will be generated for all groups.- Parameters:
output_dir (
os.PathLikeorNone, default=None) -- Directory for saving plots as png files. The directory will be created if it does not exist. If None, plots will not be saved.suffix_title (
strorNone, default=None) -- Appended to the title of each plot.suffix_filename (
strorNone, default=None) -- Appended to the filename of each saved plot ifoutput_diris provided.plot_options ({"outer_product", "heatmap"} or
list["outer_product", "heatmap"], default="outer_product") -- Type of plots to create. Options are "outer_product" or "heatmap".visual_scope ({"regions", "nodes"} or
list["regions", "nodes"], default="regions") -- Determines whether plotting is done at the region level or node level. For "regions", the values of all nodes in the same regions (including both hemispheres) are averaged together then plotted. For "nodes", plots individual node values separately.show_figs (
bool, default=True) -- Display figures.subplots (
bool, default=True) -- Produce subplots for outer product plots, combining all plots into a single figure.**kwargs --
Keyword arguments used when saving figures. Valid keywords include:
dpi:
int, default=300 -- Dots per inch for the figure.figsize:
tuple, default=(8, 6) -- Size of the figure in inches.fontsize:
int, default=14 -- Font size for the title of individual plots or subplots.hspace:
float, default=0.4 -- Height space between subplots.wspace:
float, default=0.4 -- Width space between subplots.xticklabels_size:
int, default=8 -- Font size for x-axis tick labels.yticklabels_size:
int, default=8 -- Font size for y-axis tick labels.shrink:
float, default=0.8 -- Fraction by which to shrink the colorbar.cbarlabels_size:
int, default=8 -- Font size for the colorbar labels.nrow:
int, default=varies (max 5) -- Number of rows for subplots. Default varies but the maximum is 5.ncol:
intorNone, default=None -- Number of columns for subplots. Default varies but the maximum is 5.suptitle_fontsize:
float, default=0.7 -- Font size for the main title when subplot is True.tight_layout:
bool, default=True -- Use tight layout for subplots.rect:
list[int], default=[0, 0.03, 1, 0.95] -- Rectangle parameter fortight_layoutwhensubplotsare True. Fixes whitespace issues.sharey:
bool, default=True -- Share y-axis labels for subplots.xlabel_rotation:
int, default=0 -- Rotation angle for x-axis labels.ylabel_rotation:
int, default=0 -- Rotation angle for y-axis labels.annot:
bool, default=False -- Add values to cells.annot_kws:
dict, default=None -- Customize the annotations.fmt:
str, default=".2g" -- Modify how the annotated vales are presented.linewidths:
float, default=0 -- Padding between each cell in the plot.borderwidths:
float, default=0 -- Width of the border around the plot.linecolor:
str, default="black" -- Color of the line that seperates each cell.edgecolors:
strorNone, default=None -- Color of the edges.alpha:
floatorNone, default=None -- Controls transparency and ranges from 0 (transparent) to 1 (opaque).bbox_inches:
strorNone, default="tight" -- Alters size of the whitespace in the saved image.hemisphere_labels:
bool, default=False -- Whenvisual_scope="nodes", shows simplified left/right hemisphere division line instead of individual node labels (only for Custom and Schaefer parcellations). For Custom parcellations, assumes labels are ordered such that all left hemisphere nodes come before right hemisphere nodes. Ignores edgecolors; linewidths/linecolor only affect division line.cmap:
str,callabledefault="coolwarm" -- Color map for the plot cells. Options include strings to call seaborn's pre-made palettes,seaborn.diverging_palettefunction to generate custom palettes, andmatplotlib.color.LinearSegmentedColormapto generate custom palettes.vmin:
floatorNone, default=None -- The minimum value to display in colormap.vmax:
floatorNone, default=None -- The maximum value to display in colormap.
- Returns:
self
Note
Parcellation Approach: the "nodes" and "regions" sub-keys are required in
parcel_approachfor this function.Color Palettes: Refer to seaborn's Color Palettes for valid pre-made palettes.