grassp.pl.tagm_map_pca_ellipses

grassp.pl.tagm_map_pca_ellipses#

tagm_map_pca_ellipses(adata, stds=[1, 2, 3], dimensions=None, components=None, ax=None, scatter_kwargs={}, **kwargs)[source]#

Visualize TAGM component covariance as ellipses in PCA space.

For each TAGM component the posterior covariance matrix is projected into PCA space and visualised as an ellipse representing n standard- deviation contours (defined by the stds list).

Parameters:
adata AnnData

Annotated data matrix that contains adata.varm["PCs"] (loadings) and TAGM posterior parameters under adata.uns["tagm.map.params"].

stds List[int] (default: [1, 2, 3])

Radii of the ellipses in standard deviations. Typical choices are [1, 2, 3] which correspond to the 68 %, 95 % and 99.7 % confidence regions of a multivariate normal distribution.

dimensions tuple[int, int] | None (default: None)

Specify which principal components to plot—either via an explicit dimensions tuple (0-based indices) or the Scanpy-style components string (e.g. "1,2").

components Union[str, Sequence[str], None] (default: None)

Specify which principal components to plot—either via an explicit dimensions tuple (0-based indices) or the Scanpy-style components string (e.g. "1,2").

ax Axes | None (default: None)

Matplotlib axes to plot on. If None, matplotlib.pyplot.gca() is used.

scatter_kwargs dict | None (default: {})

Additional keyword arguments forwarded to scatter().

**kwargs

Additional keyword arguments forwarded to Ellipse (e.g. linewidth, alpha).

Return type:

Axes

Returns:

The axes with the ellipse overlay (returned if show is False).