voyagerpy.plotting.spatial_reduced_dim#

voyagerpy.plotting.spatial_reduced_dim(adata: AnnData, dimred: str, ncomponents: int | Sequence[int], **kwargs) ndarray[Any, dtype[Axes]]#

Plot spatially reduced dimensions.

This function plots the values of the spatially reduced dimensions for barcodes using plot_spatial_feature().

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

  • dimred (str) – The name of the dimension reduction to use.

  • ncomponents (Union[int, Sequence[int]]) – The number of components to plot. Each component will be plotted on a separate axes. If a sequence of integers is provided, each integer will be used as the index of the component to plot. If int, the first ncomponents components will be plotted.

Returns:

The axes used for plotting.

Return type:

npt.NDArray[Axes]

Raises:
  • TypeError – If ncomponents is not an integer or a sequence of integers.

  • ValueError – If dimred is not found in adata.obsm.

See also

:py:func:plot_spatial_feature