voyagerpy.plotting.plot_moran_mc#
- voyagerpy.plotting.plot_moran_mc(adata: AnnData, feature: str | Sequence[str], graph_name: str | None = None, cmap: str | None = None, ax: Axes | None = None, legend_title: str = 'feature', **kwargs) Axes#
Plots simulated Moran’s I values for a feature or features.
The simulated values of Moran’s I are plotted individually for each feature, with the true Moran’s I value plotted as a vertical line in the same color as the simulated values.
The
graph_nameparameter is used to retrieve the Moran’s I values from theadata.unsdictionary. The functionvp.spatial.moranmust have been called previously with the samegraph_nameparameter and .- Parameters:
adata (AnnData) – The annotated data matrix.
feature (Union[str, Sequence[str]]) – The feature or features to plot.
graph_name (Optional[str], optional) – The graph name used when computing Moran’s I for the feature, by default None
cmap (Optional[str], optional) – The colormap to use, by default None
ax (Optional[Axes], optional) – The Axes to draw on. If None then a new Axes is created, by default None
legend_title (str, optional) – The title of the legend, by default “feature”.
**kwargs – Keyword arguments to pass to
vp.plt.configure_subplots(). May also include"linewidth".
- Returns:
The axes drawn on.
- Return type:
Axes
- Raises:
KeyError – If either “moran” or “moran_mc” is not in
adata.uns["spatial"]. Both keys must exist.