spac.visualization.dimensionality_reduction_plot(adata, method=None, annotation=None, feature=None, layer=None, ax=None, associated_table=None, **kwargs)[source]

Visualize scatter plot in PCA, t-SNE, UMAP, or associated table.

Parameters:
  • adata (anndata.AnnData) – The AnnData object with coordinates precomputed by the ‘tsne’ or ‘UMAP’ function and stored in ‘adata.obsm[“X_tsne”]’ or ‘adata.obsm[“X_umap”]’

  • method (str, optional (default: None)) – Dimensionality reduction method to visualize. Choose from {‘tsne’, ‘umap’, ‘pca’}.

  • annotation (str, optional) – The name of the column in adata.obs to use for coloring the scatter plot points based on cell annotations.

  • feature (str, optional) – The name of the gene or feature in adata.var_names to use for coloring the scatter plot points based on feature expression.

  • layer (str, optional) – The name of the data layer in adata.layers to use for visualization. If None, the main data matrix adata.X is used.

  • ax (matplotlib.axes.Axes, optional (default: None)) – A matplotlib axes object to plot on. If not provided, a new figure and axes will be created.

  • associated_table (str, optional (default: None)) – Name of the key in obsm that contains the numpy array. Takes precedence over method

  • **kwargs – Parameters passed to visualize_2D_scatter function, including point_size.

Returns:

  • fig (matplotlib.figure.Figure) – The created figure for the plot.

  • ax (matplotlib.axes.Axes) – The axes of the plot.