mantispy.pl.metrics

Contents

mantispy.pl.metrics#

mantispy.pl.metrics(table, ax=None)[source]#

Grouped bars of a tidy metrics table, one group of bars per metric and one bar per representation.

Takes the table instead of an AnnData because the table already holds every representation side by side.

Parameters:
  • table (DataFrame) – A tidy frame with metric, representation and value and one row per pair, as known_relationships() returns. A batch_variance_explained() frame stacks several covariates under one metric="pc_regression", so rename each to a distinct metric such as pc_regression:<key> before plotting, or it cannot be pivoted into a grid. Its better column, when present, adds the direction that is an improvement to each tick label.

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

Return type:

Axes | None

Returns:

The axes when the caller passed ax, else None because the plot then owns the figure it created. When returned they hold one group of bars per metric and one bar per representation.

Raises:

ValueError – The table holds more than one value for some metric and representation, which cannot be pivoted into a grid.