deepspatial.vis_utils.interactive_3d_labels

deepspatial.vis_utils.interactive_3d_labels#

deepspatial.vis_utils.interactive_3d_labels(adata: AnnData, color_col: str = 'cell_class', focus_categories: List[str] | None = None, palette: Dict[str, str] | None = None, spatial_key: str = 'spatial', z_key: str = 'z_coord', point_size: float = 1.5, opacity: float = 0.8, bg_color: str = 'white', max_points: int = 250000, title: str = '3D Cell Type Distribution', width: int | None = None, height: int | None = None, save_html: str | None = None) Figure[source]#

Generate an interactive Plotly 3D scatter plot for categorical metadata.

Parameters:
  • adata (ad.AnnData) – Annotated data matrix.

  • color_col (str) – Column in adata.obs representing categories.

  • focus_categories (list of str, optional) – Specific categories to highlight. Non-highlighted cells become faint.

  • palette (dict, optional) – Mapping of categories to colors.

  • spatial_key (str) – Key in adata.obsm for XY coordinates.

  • z_key (str) – Key in adata.obs for Z coordinate.

  • point_size (float) – Marker size.

  • opacity (float) – Marker opacity (0.0 to 1.0).

  • bg_color (str) – Background color.

  • max_points (int) – Maximum rendering limit for browser performance.

  • title (str) – Plot title.

  • width (int, optional) – Dimensions of the rendering canvas in pixels.

  • height (int, optional) – Dimensions of the rendering canvas in pixels.

  • save_html (str, optional) – Path to save as a standalone interactive HTML file.

Return type:

plotly.graph_objects.Figure