dynamo.pl.biplot(adata, pca_components=[0, 1], pca_key='X_pca', loading_key='PCs', figsize=(6, 4), scale_pca_embedding=False, draw_pca_embedding=False, save_show_or_return='show', save_kwargs={}, ax=None)[source]

A biplot overlays a score plot and a loadings plot in a single graph. In such a plot, points are the projected observations; vectors are the projected variables. If the data are well-approximated by the first two principal components, a biplot enables you to visualize high-dimensional data by using a two-dimensional graph. See more at: https://blogs.sas.com/content/iml/2019/11/06/what-are-biplots.html

In general, the score plot and the loadings plot will have different scales. Consequently, you need to rescale the vectors or observations (or both) when you overlay the score and loadings plots. There are four common choices of scaling. Each scaling emphasizes certain geometric relationships between pairs of observations (such as distances), between pairs of variables (such as angles), or between observations and variables. This article discusses the geometry behind two-dimensional biplots and shows how biplots enable you to understand relationships in multivariate data.

  • adata (AnnData) – An Annodata object that has pca and loading information prepared.

  • pca_components (Sequence[int]) – The pca components that will be used to draw the biplot.

  • pca_key (str) – A key to the pca embedding matrix, in .obsm.

  • loading_key (str) – A key to the pca loading matrix, in either .uns or .obsm.

  • figsize (tuple) – The figure size.

  • scale_pca_embedding (bool) – Whether to scale the pca embedding.

  • draw_pca_embedding (bool) – Whether to draw the pca embedding.

  • save_show_or_return ({‘show’, ‘save’, ‘return’} (default: show)) – Whether to save, show or return the figure.

  • save_kwargs (dict (default: {})) – A dictionary that will passed to the save_fig function. By default it is an empty dictionary and the save_fig function will use the {“path”: None, “prefix”: ‘biplot’, “dpi”: None, “ext”: ‘pdf’, “transparent”: True, “close”: True, “verbose”: True} as its parameters. Otherwise you can provide a dictionary that properly modify those keys according to your needs.

  • ax (Optional[SubplotBase]) – An ax where the biplot will be appended to.


  • If save_show_or_return is not return, return nothing but plot or save the biplot; otherwise return an axes

  • with the biplot in it.