dynamo.pl.divergence(adata, basis='pca', color=None, cmap='bwr', frontier=True, sym_c=True, *args, **kwargs)[source]

Scatter plot with cells colored by the estimated divergence (and other information if provided).

Cells with negative or positive divergence correspond to possible sink (stable cell types) or possible source (unstable metastable states or progenitors)

  • adata (AnnData) – an Annodata object with divergence estimated.

  • basis (str or None (default: pca)) – The embedding data in which the vector field was reconstructed and RNA divergence was estimated.

  • color (str, list or None:) – Any column names or gene names, etc. in addition to the divergence to be used for coloring cells.

  • frontier (bool (default: False)) – Whether to add the frontier. Scatter plots can be enhanced by using transparency (alpha) in order to show area of high density and multiple scatter plots can be used to delineate a frontier. See matplotlib tips & tricks cheatsheet (https://github.com/matplotlib/cheatsheets). Originally inspired by figures from scEU-seq paper: https://science.sciencemag.org/content/367/6482/1151.

  • sym_c (bool (default: False)) – Whether do you want to make the limits of continuous color to be symmetric, normally this should be used for plotting velocity, divergence or other types of data with both positive or negative values.

Return type:

Nothing but plots scatterplots with cells colored by the estimated divergence (and other information if provided).


>>> import dynamo as dyn
>>> adata = dyn.sample_data.hgForebrainGlutamatergic()
>>> dyn.pp.recipe_monocle(adata)
>>> dyn.tl.dynamics(adata)
>>> dyn.tl.cell_velocities(adata, basis='pca')
>>> dyn.vf.VectorField(adata, basis='pca')
>>> dyn.vf.divergence(adata)
>>> dyn.pl.divergence(adata)

See also:: external.ddhodge.divergence() for calculating divergence with a diffusion graph built from reconstructed vector field.