voyagerpy.plotting.plot_correlogram#

voyagerpy.plotting.plot_correlogram(adata: AnnData, graph_name: str | None = None, metric: str = 'moran', order: None | Tuple[int | None, ...] | List[int] = None, show_symbol: bool = True, ax: Axes | None = None, features: List[str] | None = None, cmap: str | None = None) Axes#

Plot a correlogram of spatial autocorrelation.

All features are plotted in the same Axes. The features are indices in the correlogram dataframe. The correlogram dataframe must exist and accessed by adata.uns["spatial"][metric]["correlogram"].

Parameters:
  • adata (AnnData) – The annotated data matrix.

  • graph_name (Optional[str], optional) – The name of the graph used for computing the correlogram. If None, use the default graph, by default None

  • metric (str, optional) – The name of the spatial autocorrelation metric to use, by default “moran”

  • order (Union[None, Tuple[Optional[int], ...], List[int]], optional) – Reorder the columns is desired, by default None. If tuple, a slice() is created from the tuple and applied to the columns of the dataframe.

  • show_symbol (bool, optional) – Show the gene symbol in the legend instead of its id, by default True

  • ax (Optional[Axes], optional) – _description_, by default None

  • features (Optional[List[str]], optional) – The features to include in the correlogram. If None, use all features available, by default None

  • cmap (Optional[str], optional) – The colormap to use, by default None

Returns:

The axes used for plotting.

Return type:

Axes

Raises:

KeyError – If graph_name is not found in adata.uns[“spatial”][metric][“correlogram’].