monkeybread.plot.cell_neighbor_embedding

monkeybread.plot.cell_neighbor_embedding(adata, cell_to_neighbors, group=None, basis='X_spatial', group1_name='Group 1', group2_name='Group 2', dot_size_group1=None, dot_size_group2=None, dot_size_unselected=None, palette=None, cell_color_unselected='lightgrey', show=True, ax=None, **kwargs)

Shows embeddings of cells with their neighbors.

Plots the results of monkeybread.calc.cell_neighbors(), highlighting the cells and their neighbors within the tissue.

Parameters:
  • adata (AnnData) – Annotated data matrix.

  • cell_to_neighbors (Dict[str, Set[str]]) – Cells and their associated neighbors as calculated by monkeybread.calc.cell_neighbors().

  • group (Optional[str] (default: None)) – Column in adata.obs for which to color cells. If None, cells will be labeled according to the group1_name and group2_name arguments.

  • basis (Optional[str] (default: 'X_spatial')) – Coordinates in adata.obsm[{basis}] to use. Defaults to X_spatial.

  • group1_name (Optional[str] (default: 'Group 1')) – Name of the first group of cells. Used to label the cells in the first group

  • group2_name (Optional[str] (default: 'Group 2')) – Name of the second group of cells. Used to label the cells in the second group

  • dot_size_group1 (Optional[float] (default: None)) – Size of the dots denoting cells in the first group

  • dot_size_group2 (Optional[float] (default: None)) – Size of the dots denoting cells in the second group

  • dot_size_unselected (Optional[float] (default: None)) – Size of the dots denoting cells in neither the first nor second group

  • palette (Optional[List[str]] (default: None)) – Color palette used to color the cells

  • cell_color_unselected (Optional[str] (default: 'lightgrey')) – Color of cells that are neither in the first nor second group

  • show (Optional[bool] (default: True)) – Whether to show the plot or return the Axes object.

  • ax (Optional[Axes] (default: None)) – An Axes object to add the plots to.

  • kwargs – Keyword arguments that will be passed to scanpy.pl.embedding().

Return type:

Optional[Axes]

Returns:

: If show = True, returns nothing. Otherwise, returns the Axes object the plot is contained within.

https://raw.githubusercontent.com/immunitastx/monkeybread/main/docs/_static/cell_neighbor_embedding.png