partipy.plot_archetypes_2D

partipy.plot_archetypes_2D#

partipy.plot_archetypes_2D(adata, dimensions=None, show_contours=False, contours_confidence_level=0.95, contours_size=2.0, contours_alpha=0.75, color=None, alpha=0.5, size=None, result_filters=None)#

Generate a static 2D scatter plot showing data points, archetypes and the polytope they span.

This function visualizes the archetypes computed via Archetypal Analysis (AA) in PCA space, along with the data points. An optional color vector can be used to annotate the data points.

Parameters:
  • adata (anndata.AnnData) – Annotated data object containing archetypal analysis results in adata.uns["AA_results"] and PCA-reduced data in adata.obsm[obsm_key].

  • dimensions (list[int] | None, default None) – List of two integers specifying the dimensions to plot. If None, uses the first two dimensions.

  • show_contours (bool, default True) – If True, a multivariate Gaussian distribution is fit per archetype, and a contour line for one confidence level is shown.

  • color (str | None, default None) – Column name in adata.obs to use for coloring the data points. If None, no coloring is applied.

  • alpha (float, default 1.0) – Opacity of the points in the scatter plot (0.0 to 1.0).

  • size (float | None, default None) – Size of the points in the scatter plot. If None, uses the default size of the plotting library.

  • result_filters (Mapping[str, Any] | None, default None) – Filters forwarded to _resolve_aa_result to select a specific cached AA configuration.

  • contours_confidence_level (float)

  • contours_size (float)

  • contours_alpha (float)

Return type:

ggplot

Returns:

pn.ggplot A static 2D scatter plot showing the data and archetypes.