vampire.anno.pl.motif_abundance_pca#
- vampire.anno.pl.motif_abundance_pca(adata, color_by=None, shape_by=None, components=(1, 2), figsize=(None, None), title=None, marker_size=10, colormap=None, show_variance=True, save=None, **kwargs)[source]#
Plot pairwise principal components from motif abundance PCA.
Reads pre-computed PCA results stored by
vp.anno.tl.motif_abundance_pca(). Color and marker shape can be mapped to columns inadata.obs.- Parameters:
adata (
AnnData) – Annotated data with PCA results fromvp.anno.tl.motif_abundance_pca().color_by (
str|None) – Column inadata.obsfor marker color. Categorical columns use a discrete palette; numeric columns use a continuous colorscale.shape_by (
str|None) – Column inadata.obsfor marker shape. Must be categorical.components (
tuple[int,int]) – Which two PCs to plot. 1-based indexing, e.g.(1, 2)for PC1 vs PC2,(2, 3)for PC2 vs PC3.figsize (
tuple[int|None,int|None]) – Figure size in pixels.title (
str|None) – Plot title.marker_size (
int) – Marker size.colormap (
str|list[str] |None) – Plotly colormap name for numericcolor_by. Defaults to"Viridis".show_variance (
bool) – Append explained-variance percentages to axis titles.**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:
Plotly scatter figure of the chosen PCs.
- 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(adata, color_by="copy_number", components=(1, 2))