mantispy.pl.similarity

Contents

mantispy.pl.similarity#

mantispy.pl.similarity(adata, key='similarity', groupby='Metadata_Perturbation', max_obs=500, ax=None)[source]#

Profile-by-profile similarity, ordered by groupby so blocks are visible.

Subsamples to max_obs rows with a fixed seed when the object is larger, because the matrix is quadratic.

Parameters:
  • adata (AnnData) – Object holding the matrix similarity() wrote in obsp.

  • key (str (default: 'similarity')) – Name of that matrix in obsp.

  • groupby (str | None (default: 'Metadata_Perturbation')) – obs column to order the rows and columns by, or None to keep the object’s own order.

  • max_obs (int (default: 500)) – Draw at most this many profiles, sampled from the ordering rather than from the rows.

  • 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 the ordered matrix on a diverging scale fixed to [-1, 1] with a colorbar beside it.

Raises:

KeyError – obsp holds nothing under key.