voyagerpy.plotting.moran_plot#

voyagerpy.plotting.moran_plot(adata: AnnData, feature: str | Sequence, graph_name: None | str | ndarray = None, color_by: str | None = None, xlim: Tuple[float, float] | None = None, ylim: Tuple[float, float] | None = None, ax: Axes | None = None, contour_kwargs: Dict[str, Any] | None = None, show_symbol: bool = True, ncol: int = 2, legend: bool = True, subplot_kwargs: Dict[str, Any] | None = None, layer: str | None = None, **scatter_kwargs) Axes#

Create a Moran scatter plot.

The feature feature is plotted on the x-axis, with its lagged values on the y-axis. The lagged values are computed by using the weighted graph given by graph_name.

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

  • feature (Union[str, Sequence]) – The feature to plot. If a sequence, each feature is plotted in a separate subplot.

  • graph_name (Union[None, str, np.ndarray], optional) – The name of the graph in …, by default None

  • color_by (Optional[str], optional) – Color the points by this column, by default None

  • xlim (Optional[Tuple[float, float]], optional) – The limits of the x-axis. If None, these are computed automatically, by default None

  • ylim (Optional[Tuple[float, float]], optional) – The limits of the y-axis. If None, these are computed automatically, by default None

  • ax (Optional[Axes], optional) – The axes to plot on. If None, a new Axes will be created, by default None

  • contour_kwargs (Optional[Dict[str, Any]], optional) – Keyword arguments to pass to vp.plt.contour_plot(), by default None

  • show_symbol (bool, optional) – If True and feature is a gene, show the symbol on the axis labels, by default True

  • ncol (int, optional) – The number of columns in the axes grid, by default 2

  • legend (bool, optional) – Whether to show a legend, by default True

  • subplot_kwargs (Optional[Dict[str, Any]], optional) – Keyword arguments to pass to vp.plt.subplots_single_colorbar(), by default None

  • layer (Optional[str], optional) – If not None, use this layer for gene expression, by default None

Returns:

The axes with the plot.

Return type:

Axes

Raises:

ValueError – If ax is supplied and does not have the correct shape.