vampire.anno.pl.motif_abundance_pca_variance#
- vampire.anno.pl.motif_abundance_pca_variance(adata, n_pcs=None, log=False, show_cumulative=True, figsize=(None, None), title=None, save=None, **kwargs)[source]#
Plot variance explained by each principal component.
Reads pre-computed results from
vp.anno.tl.motif_abundance_pca()stored inuns['motif_abundance_pca']['variance_ratio'].- Parameters:
adata (
AnnData) – Annotated data with PCA results.n_pcs (
int|None) – Number of PCs to display. IfNone, display all.log (
bool) – Use log scale for the variance-ratio axis.show_cumulative (
bool) – Overlay a cumulative-variance line on the same y-axis.figsize (
tuple[int|None,int|None]) – Figure size in pixels.title (
str|None) – Plot title.**kwargs – Additional keyword arguments passed to
fig.update_layout().save (
str|bool|None) – IfTrueor astr, save the figure. A string is appended to the default filename. Infer the filetype if ending on {'.pdf','.png','.svg'}.
- Returns:
Bar + line plot of per-PC variance ratios.
- Return type:
Figure
Examples
>>> import vampire as vp >>> vp.anno.pl.set_default_plotstyle() >>> adata = vp.datasets.wdr7_hprc() >>> vp.anno.tl.motif_abundance_pca(adata) >>> vp.anno.pl.motif_abundance_pca_variance(adata)