neurocaps.analysis.CAP.caps2plot
- CAP.caps2plot(output_dir=None, suffix_title=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 as well as the name of the saved file 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 (
dict) --Keyword arguments used when saving figures. Valid keywords include:
- dpi:
int, default=300 Dots per inch for the figure. Default is 300 if
output_diris provided anddpiis not specified.
- dpi:
- figsize:
tuple, default=(8, 6) Size of the figure in inches.
- figsize:
- fontsize:
int, default=14 Font size for the title of individual plots or subplots.
- fontsize:
- hspace:
float, default=0.4 Height space between subplots.
- hspace:
- wspace:
float, default=0.4 Width space between subplots.
- wspace:
- xticklabels_size:
int, default=8 Font size for x-axis tick labels.
- xticklabels_size:
- yticklabels_size:
int, default=8 Font size for y-axis tick labels.
- yticklabels_size:
- shrink:
float, default=0.8 Fraction by which to shrink the colorbar.
- shrink:
- cbarlabels_size:
int, default=8 Font size for the colorbar labels.
- cbarlabels_size:
- nrow:
int, default=varies (max 5) Number of rows for subplots. Default varies but the maximum is 5.
- nrow:
- ncol:
intorNone, default=None Number of columns for subplots. Default varies but the maximum is 5.
- ncol:
- suptitle_fontsize:
float, default=0.7 Font size for the main title when subplot is True.
- suptitle_fontsize:
- tight_layout:
bool, default=True Use tight layout for subplots.
- tight_layout:
- rect:
list[int], default=[0, 0.03, 1, 0.95] Rectangle parameter for tight layout when subplots are True to fix whitespace issues.
- rect:
- sharey:
bool, default=True Share y-axis labels for subplots.
- sharey:
- xlabel_rotation:
int, default=0 Rotation angle for x-axis labels.
- xlabel_rotation:
- ylabel_rotation:
int, default=0 Rotation angle for y-axis labels.
- ylabel_rotation:
- annot:
bool, default=False Add values to cells.
- annot:
- annot_kws:
dict, default=None, Customize the annotations.
- annot_kws:
- fmt:
str, default=".2g" Modify how the annotated vales are presented.
- fmt:
- linewidths:
float, default=0 Padding between each cell in the plot.
- linewidths:
- borderwidths:
float, default=0 Width of the border around the plot.
- borderwidths:
- linecolor:
str, default="black" Color of the line that seperates each cell.
- linecolor:
- edgecolors:
strorNone, default=None Color of the edges.
- edgecolors:
- alpha:
floatorNone, default=None Controls transparency and ranges from 0 (transparent) to 1 (opaque).
- alpha:
- bbox_inches:
strorNone, default="tight" Alters size of the whitespace in the saved image.
- bbox_inches:
- hemisphere_labels:
bool, default=False Only available when
visual_scope="nodes". Simplifies node labels to show only left/right hemisphere divisions with a separation line, rather than listing individual node labels. If set to True,edgecolorsis ignored andlinewidthsandlinecoloraffect only the hemisphere division line. This option is available exclusively for "Custom" and "Schaefer" parcellations. Note, for the "Custom" parcellations, nodes must be ordered with left hemisphere nodes first, followed by right hemisphere nodes.
- hemisphere_labels:
- cmap:
strorcallabledefault="coolwarm" Color map for the plot cells. For this parameter, you can use pre-made color palettes or create custom ones. Below is a list of valid options:
Strings to call seaborn's pre-made palettes.
seaborn.diverging_palettefunction to generate custom palettes.matplotlib.colors.LinearSegmentedColormapto generate custom palettes.
- cmap:
- vmin:
floatorNone, default=None The minimum value to display in colormap.
- vmin:
- vmax:
floatorNone, default=None The maximum value to display in colormap.
- vmax:
- Returns:
seaborn.heatmap -- An instance of seaborn.heatmap.
Note
Parcellation Approach: the "nodes" and "regions" sub-keys are required in
parcel_approachfor this function.Color Palettes: For valid pre-made palettes for seaborn, refer to https://seaborn.pydata.org/tutorial/color_palettes.html