grassp.pl.tagm_map_contours#
- tagm_map_contours(adata, embedding='umap', size=100, components=None, dimensions=None, levels=4, ax=None, **kwargs)[source]#
Plot posterior density contours of TAGM components in embedding space.
The function draws synthetic observations from the TAGM posterior via
sample_tagm_map()and projects them into either UMAP or PCA space (depending onembedding). A kernel–density estimate is then computed for each component and visualized as contour lines.- Parameters:
- adata
AnnData Annotated data matrix that already contains TAGM posterior parameters in
adata.uns["tagm.map.params"]and an embedding (UMAP or PCA) fitted byumap()orscanpy.pp.pca().- embedding
Literal['umap','pca'] (default:'umap') Target space for the contours, either
"umap"or"pca".- size
int(default:100) Number of posterior samples to draw per component.
- components
Union[str,Sequence[str],None] (default:None) Specify which dimensions of the embedding to use. Only one pair of dimensions is allowed. Use
components(Scanpy style string) or adimensionstuple, not both.- dimensions
Union[tuple[int,int],Sequence[tuple[int,int]],None] (default:None) Specify which dimensions of the embedding to use. Only one pair of dimensions is allowed. Use
components(Scanpy style string) or adimensionstuple, not both.- levels
int(default:4) Number of contour levels passed to
seaborn.kdeplot().- ax
Axes|None(default:None) Matplotlib axes to plot on. If
None, the current axes returned bymatplotlib.pyplot.gca()are used.- **kwargs
Additional keyword arguments forwarded to
seaborn.kdeplot().
- adata
- Return type:
Axes- Returns:
The axes object containing the contour plot (returned for convenience).