mantispy.pl.density

Contents

mantispy.pl.density#

mantispy.pl.density(adata, feature, groupby='Metadata_Perturbation', key='Metadata_LocalDensity', max_groups=6, ax=None)[source]#

Local cell density against a feature, per group.

Crowding alone changes morphology. Use this plot to check whether density explains a phenotype before regressing it out with regress_out(). A group whose points fall on the same line as the controls differs from them only in density.

Parameters:
  • adata (AnnData) – Single-cell object carrying the density column and the feature.

  • feature (str) – Feature to plot against density.

  • groupby (str (default: 'Metadata_Perturbation')) – Column defining the groups drawn.

  • key (str (default: 'Metadata_LocalDensity')) – obs column holding the local density.

  • max_groups (int (default: 6)) – Number of groups drawn, largest first.

  • ax (Axes | None (default: None)) – Axes to draw on.

Returns:

The axes. The legend gives each group’s Pearson correlation between density and the feature.