mantispy.pl.batch_variance

Contents

mantispy.pl.batch_variance#

mantispy.pl.batch_variance(adata, keys, use_rep='X_pca', n_comps=None, ax=None)#

R^2 of each principal component on each covariate.

A covariate with high R^2 in the leading components accounts for much of the embedding’s structure.

Parameters:
  • adata (AnnData) – Object with the embedding to measure in.

  • keys (Sequence[str]) – obs columns to score, one line each.

  • use_rep (str (default: 'X_pca')) – obsm key of the embedding.

  • n_comps (int | None (default: None)) – Draw only the leading components, or None for every component the embedding holds.

  • ax (Axes | None (default: None)) – Axes to draw on, or None for a new figure.

Return type:

Axes

Returns:

The axes drawn on, with one line per entry of keys and the y axis fixed to [0, 1].

Raises:

KeyErrorobsm holds nothing under use_rep, or obs has no column for one of keys.