dynamo.pl.variance_explained

dynamo.pl.variance_explained(adata, threshold=0.002, n_pcs=None, figsize=(4, 3), save_show_or_return='show', save_kwargs={})[source]

Plot the accumulative variance explained by the principal components.

Parameters:
  • adata (AnnData) – an AnnDate object.

  • threshold (float) – the threshold for the second derivative of the cumulative sum of the variance for each principal component. This threshold is used to determine the number of principle components used for downstream non- linear dimension reduction. Defaults to 0.002.

  • n_pcs (Optional[int]) – the number of principal components. If None, the number of components would be inferred automatically. Defaults to None.

  • figsize (Tuple[float, float]) – the size of each panel of the figure. Defaults to (4, 3).

  • save_show_or_return (Literal['save', 'show', 'return']) – whether to save, show, or return the generated figure. Can be one of ‘save’, ‘show’, or ‘return’. 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”: ‘variance_explained’, “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 {}.

Return type:

Axes

Returns:

None would be returned by default. If save_show_or_return is set to be ‘return’, the matplotlib Axes of the figure would be returned.