opendvp.plotting.pca

Contents

opendvp.plotting.pca#

opendvp.plotting.pca(adata, color=None, group_colors=None, symbol=None, hoverwith=None, choose_PCs=[1, 2], multi_scatter=False, how_many_PCs=4, scatter_3d=False, save_path=None, return_fig=False, **kwargs)#

Plot PCA of samples in an AnnData object using Plotly.

Return type:

Figure | None

Parameters#

adataAnnData

Annotated data matrix.

colorstr, optional

Column in adata.obs to color points by.

group_colorsdict, optional

Dictionary mapping group names to colors.

symbolstr, optional

Column in adata.obs to use for marker symbol.

hoverwithlist of str, optional

Columns in adata.obs to show on hover.

choose_PCslist of int, optional

Principal components to plot (1-based index).

multi_scatterbool, optional

If True, plot a scatter matrix of the first how_many_PCs.

how_many_PCsint, optional

Number of PCs to use in scatter matrix.

scatter_3dbool, optional

If True, plot a 3D scatter plot of the first 3 PCs.

save_pathstr, optional

Path to save the figure as an image or HTML.

return_figbool, optional

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

**kwargs

Additional keyword arguments passed to plotly express functions.

Returns:#

figplotly.graph_objs.Figure or None

The figure object if return_fig is True, otherwise None.