dynamo.pl.plot_energy(adata, basis=None, vecfld_dict=None, figsize=None, fig=None, save_show_or_return='show', save_kwargs={})[source]

Plot the energy and energy change rate over each optimization iteration.

  • adata (AnnData) – an Annodata object with vector field function reconstructed.

  • basis (Optional[str]) – the reduced dimension embedding (pca or umap, for example) of cells from which vector field function was reconstructed. When basis is None, the velocity vector field function building from the full gene expression space is used. Defaults to None.

  • vecfld_dict (Optional[dict]) – the dictionary storing the information for the reconstructed velocity vector field function. If None, the corresponding dictionary stored in the adata object will be used. Defaults to None.

  • figsize (Optional[Tuple[float, float]]) – the width and height of the resulting figure when fig is set to be None. Defaults to None.

  • fig (Optional[Figure]) – the figure object where panels of the energy or energy change rate over iteration plots will be appended to. Defaults to None.

  • save_show_or_return (Literal['save', 'show', 'return']) – whether to save, show or return the figure. Defaults to “show”.

  • save_kwargs (Dict[str, Any]) – a dictionary that will be passed to the save_show_ret function. By default, it is an empty dictionary and the save_show_ret function will use the {“path”: None, “prefix”: ‘energy’, “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.. Defaults to {}.


ValueError – invalid basis.

Return type:



None would be returned by default. If save_show_or_return is set to ‘return’, the matplotlib Figure object of the graph would be returned.