- spac.visualization.interative_spatial_plot(adata, annotations, dot_size=1.5, dot_transparancy=0.75, colorscale='viridis', figure_width=6, figure_height=4, figure_dpi=200, font_size=12, stratify_by=None, defined_color_map=None, **kwargs)[source]
Create an interactive scatter plot for spatial data using provided annotations.
- Parameters:
adata (AnnData) – Annotated data matrix object, must have a .obsm attribute with ‘spatial’ key.
annotations (list of str or str) – Column(s) in adata.obs that contain the annotations to plot. If a single string is provided, it will be converted to a list. The interactive plot will show all the labels in the annotation columns passed.
dot_size (float, optional) – Size of the scatter dots in the plot. Default is 1.5.
dot_transparancy (float, optional) – Transparancy level of the scatter dots. Default is 0.75.
colorscale (str, optional) – Name of the color scale to use for the dots. Default is ‘Viridis’.
figure_width (int, optional) – Width of the figure in inches. Default is 12.
figure_height (int, optional) – Height of the figure in inches. Default is 8.
figure_dpi (int, optional) – DPI (dots per inch) for the figure. Default is 200.
font_size (int, optional) – Font size for text in the plot. Default is 12.
stratify_by (str, optional) – Column in adata.obs to stratify the plot. Default is None.
defined_color_map (str, optional) – Predefined color mapping stored in adata.uns for specific labels. Default is None, which will generate the color mapping automatically.
**kwargs – Additional keyword arguments for customization.
- Returns:
A list of dictionaries, each containing the following keys: - “image_name”: str, the name of the generated image. - “image_object”: Plotly Figure object.
- Return type:
list of dict
Notes
This function is tailored for spatial single-cell data and expects the AnnData object to have spatial coordinates in its .obsm attribute under the ‘spatial’ key.