opendvp.pl.pca_loadings#
- pca_loadings(adata, top=30, n_pcs=2, return_fig=False, ax=None, **kwargs)#
Plot PCA protein loadings for the top features in the first two principal components.
- Parameters:
adata (anndata.AnnData) – Annotated data matrix with PCA results in adata.varm[‘PCs’] and adata.uns[‘pca’][‘variance_ratio’].
top (int, optional) – Number of top features to label per PC.
n_pcs (int, optional) – Number of principal components to plot (default 2).
return_fig (bool, optional) – If True, returns the matplotlib Figure object for further customization. If False, shows the plot.
ax (matplotlib.axes.Axes, optional) – Axes object to plot on. If None, a new figure and axes are created.
**kwargs – Additional keyword arguments passed to matplotlib scatter.
- Returns:
fig – The figure object if return_fig is True, otherwise None.
- Return type:
matplotlib.figure.Figure or None