dynamo.pl.plot_3d_streamtube

dynamo.pl.plot_3d_streamtube(adata, color, layer, group, init_group, basis='umap', dims=[0, 1, 2], theme=None, background=None, cmap=None, color_key=None, color_key_cmap=None, html_fname=None, save_show_or_return='show', save_kwargs={})[source]

Plot an interative 3d streamtube plot via plotly.

A streamtube is a tubular region surrounded by streamlines that form a closed loop. It’s a continuous version of a streamtube plot (3D quiver plot) and can provide insight into flow data from natural systems. The color of tubes is determined by their local norm, and the diameter of the field by the local divergence of the vector field.

Parameters:
  • adata (AnnData) – an Annodata object, must have vector field reconstructed for the input basis whose dimension should at least 3D.

  • color (str) – any column names or gene expression, etc. that will be used for coloring cells.

  • layer (str) – the layer key of the expression data.

  • group (str) – the column names of adata.obs that will be used to search for cells, together with init_group to set the initial state of the streamtube.

  • init_group (str) – the group name among all names in group that will be used to set the initial states of the stream tube.

  • basis (str) – the reduced dimension. Defaults to “umap”.

  • dims (List[int]) – the number of dimensions that will be used to construct the vector field for streamtube plot. Defaults to [0, 1, 2].

  • theme (Optional[str]) – the theme of the plot. Defaults to None.

  • background (Optional[str]) – the background color of the plot. Defaults to None.

  • cmap (Optional[str]) – The name of a matplotlib colormap to use for coloring the plots. Defaults to None.

  • color_key (Union[Dict[str, str], List[str], None]) – the method to assign colors to categoricals. Defaults to None.

  • color_key_cmap (Optional[str]) – the name of a matplotlib colormap to use for categorical coloring. Defaults to None.

  • html_fname (Optional[str]) – html file name that will be used to save the streamtube interactive plot. Defaults to None.

  • save_show_or_return (Literal['save', 'show', 'return']) – whether to save, show, or return the figures. Defaults to “show”.

  • save_kwargs (Dict[str, Any]) – A dictionary that will be passed to the save_fig function. By default, it is an empty dictionary and the save_fig function will use the {“path”: None, “prefix”: ‘scatter’, “dpi”: None, “ext”: ‘pdf’, “transparent”: True, “close”: True, “verbose”: True} as its parameters. Otherwise, you can provide a dictionary that properly modify those keys according to your needs. Defaults to {}.

Raises:

ImportError – plotly is not installed.

Returns:

None would be returned by default. If save_show_or_return is set to be ‘return’, the generated plotly figure would be returned.