mantispy.pl.plate

Contents

mantispy.pl.plate#

mantispy.pl.plate(adata, color, plate=None, groupby=None, agg='median', ncols=4, share_colorbar=True, ax=None, cmap='viridis', **kwargs)[source]#

Well-grid heatmap of color, one panel per plate.

Parameters:
  • adata (AnnData) – Object to draw. Works at cell or well resolution; several rows landing in the same well are combined with agg.

  • color (str) – A feature name or an obs column.

  • plate (str | None (default: None)) – Draw only this plate. By default every plate gets a panel.

  • groupby (str | None (default: None)) – obs column, constant per plate, to order and title the panels by, such as "Metadata_Batch".

  • agg (str (default: 'median')) – How to combine rows sharing a well: median, mean, max or min.

  • ncols (int (default: 4)) – Panels per row.

  • share_colorbar (bool (default: True)) – One color scale and colorbar for all panels, instead of one per panel.

  • ax (Axes | None (default: None)) – Axes to draw into. Only valid together with plate.

  • cmap (str (default: 'viridis')) – Matplotlib colormap.

  • kwargs (Any) – Passed to imshow(). vmin, vmax or norm set the scale.

Return type:

Axes | ndarray | None

Returns:

The single Axes when the caller passed ax (valid only for one plate), else None because the plot then owns the figure it created. When several plates are drawn each panel is labeled with the plate’s own well grid.

Raises:
  • ValueError – agg is not one of AGGREGATIONS, ax was passed for more than one plate, groupby varies within a drawn plate, or it or Metadata_Plate has missing values.

  • KeyError – color is neither a feature name nor an obs column, groupby is not an obs column, or plate is not a plate of adata.