opendvp.plotting.pca_loadings

Contents

opendvp.plotting.pca_loadings#

opendvp.plotting.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.

Return type:

Figure | None

Parameters#

adataAnnData

Annotated data matrix with PCA results in adata.varm[‘PCs’] and adata.uns[‘pca’][‘variance_ratio’].

topint, optional

Number of top features to label per PC.

n_pcsint, optional

Number of principal components to plot (default 2).

return_figbool, optional

If True, returns the matplotlib Figure object for further customization. If False, shows the plot.

axmatplotlib.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:#

figmatplotlib.figure.Figure or None

The figure object if return_fig is True, otherwise None.