spatialvi.utils.plot_proportions

spatialvi.utils.plot_proportions#

spatialvi.utils.plot_proportions(adata, proportions_key='proportions', spatial_key='spatial', cell_types=None, ncols=3, size=10, cmap='Reds', show=True, **kwargs)[source]#

Plot cell type proportions in spatial coordinates.

Parameters:
  • adata (AnnData) – AnnData object.

  • proportions_key (str) – Key in obsm for proportions.

  • spatial_key (str) – Key in obsm for spatial coordinates.

  • cell_types (list[str] | None) – Cell types to plot. If None, plots all.

  • ncols (int) – Number of columns in subplot grid.

  • size (float) – Point size.

  • cmap (str) – Colormap.

  • show (bool) – Whether to show the plot.

  • **kwargs – Additional arguments for scatter.

  • adata (AnnData)

  • proportions_key (str)

  • spatial_key (str)

  • cell_types (list[str] | None)

  • ncols (int)

  • size (float)

  • cmap (str)

  • show (bool)

Return type:

Figure | None

Returns:

Matplotlib figure if show=False.