squidpy.im.ImageContainer.interactive

ImageContainer.interactive(adata, spatial_key='spatial', library_key=None, library_id=None, cmap='viridis', palette=None, blending='opaque', symbol='disc', key_added='shapes')[source]

Launch napari viewer.

Parameters
  • adata (AnnData) – Annotated data object.

  • spatial_key (str) – Key in anndata.AnnData.obsm where spatial coordinates are stored.

  • library_key (Optional[str]) – Key in adata.AnnData.obs specifying mapping between observations and library ids. Required if the container has more than 1 Z-dimension.

  • library_id (Union[str, Sequence[str], None]) – Subset of library ids to visualize. If None, visualize all library ids.

  • cmap (str) – Colormap for continuous variables.

  • palette (Optional[str]) – Colormap for categorical variables in anndata.AnnData.obs. If None, use scanpy’s default.

  • blending (Literal[‘opaque’, ‘translucent’, ‘additive’]) – Method which determines how RGB and alpha values of napari.layers.Shapes are mixed.

  • symbol (Literal[‘disc’, ‘square’]) –

    Symbol to use for the spots. Valid options are:

    • ’disc’ - circle.

    • ’square’ - square.

  • key_added (str) –

    Key where to store napari.layers.Shapes, which can be exported by pressing SHIFT-E:

    • anndata.AnnData.obs ['{layer_name}_{key_added}'] - boolean mask containing the selected cells.

    • anndata.AnnData.uns ['{layer_name}_{key_added}']['meshes'] - list of numpy.array, defining a mesh in the spatial coordinates.

    See napari’s tutorial for more information about different mesh types, such as circles, squares etc.

Return type

TypeVar(Interactive)

Returns

Interactive view of this container. Screenshot of the canvas can be taken by squidpy.pl.Interactive.screenshot().