mantispy.pl.dendrogram

Contents

mantispy.pl.dendrogram#

mantispy.pl.dendrogram(adata, key='cluster', color_threshold=None, ax=None)[source]#

Draw the hierarchical clustering tree stored by cluster().

Parameters:
  • adata (AnnData) – Object holding the linkage matrix cluster() wrote with method="hierarchical".

  • key (str (default: 'cluster')) – The key_added that run used, whose summary (leaf labels and the chosen cut) is read from uns["mantispy"][key].

  • color_threshold (float | None (default: None)) – Height below which branches share a colour, marking the clusters. Defaults to the cut cluster() chose, or scipy’s own default when that run set the count directly.

  • 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 tree, with the profiles as leaves and merge height on the y axis.

Raises:

KeyError – uns["mantispy"] holds no key + "_linkage" (the run used method="leiden", or none ran).