Vector field visualization

sctour.vf.plot_vector_field(adata: anndata._core.anndata.AnnData, zs_key: str, reverse: bool = False, vf_key: str = 'X_VF', run_neigh: bool = True, use_rep_neigh: Optional[str] = None, t_key: Optional[str] = None, n_neigh: int = 20, var_stabilize_transform: bool = False, E_key: str = 'X_umap', scale: int = 10, self_transition: bool = False, smooth: float = 0.5, density: float = 1.0, grid: bool = False, stream: bool = True, stream_density: int = 2, stream_color: str = 'k', stream_linewidth: int = 1, stream_arrowsize: int = 1, grid_density: float = 1.0, grid_arrowcolor: str = 'grey', grid_arrowlength: int = 1, grid_arrowsize: int = 1, show: bool = True, save: Optional[Union[str, bool]] = None, **kwargs)

Visualize the vector field. The visualization of vector field under an embedding borrows the ideas from scvelo: https://github.com/theislab/scvelo.

Parameters
  • adata – An AnnData object.

  • zs_key – The key in .obsm for storing the latent space.

  • reverse – Whether to reverse the direction of the vector field. When the pseudotime returned by get_time() function was in reverse order and you used the post-inference adjustment (reverse_time() function), please set this parameter to True. (Default: False)

  • vf_key – The key in .obsm for storing the vector field.

  • run_neigh – Whether to run neighbor detection. (Default: True)

  • use_rep_neigh – The representation in .obsm which will be used for neighbor detection.

  • t_key – The key in .obs for estimated pseudotime which will be considered when detecting neighbors.

  • n_neigh – The number of neighbors considered for each cell. (Default: 20)

  • var_stabilize_transform – Whether to perform variance-stabilizing transformation for vector field and cell-neighbor latent state difference. (Default: False)

  • E_key – The key in .obsm for embedding. (Default: ‘X_umap’)

  • scale – Scale factor for cosine similarity. (Default: 10)

  • self_transition – Whether to take self-transition into consideration. (Default: False)

  • smooth – The factor for scale in Gaussian pdf. (Default: 0.5)

  • density – Percentage of cells to show when displaying the vector field at per-cell level. (Default: 1.0)

  • grid – Whether to display vector field as arrows at grid level. (Default: False)

  • stream – Whether to display vector field as streamplot. (Default: True)

  • stream_density – The density parameter in streamplot for controlling the closeness of the streamlines. (Default: 2)

  • stream_color – The streamline color for streamplot. (Default: ‘k’)

  • stream_linewidth – The line width for streamplot. (Default: 1)

  • stream_arrowsize – The arrow size for streamplot. (Default: 1)

  • grid_density – The density for showing vector field as arrows at grid level. (Default: 1.0)

  • grid_arrowcolor – The arrow color when showing vector field as arrows at grid level. (Default: ‘grey’)

  • grid_arrowlength – The arrow length when showing vector field as arrows at grid level. (Default: 1)

  • grid_arrowsize – The arrow size when showing vector field as arrows at grid level. (Default: 1)

  • show – Whether to show the plot. (Default: True)

  • save – Whether to save the figure. If True or a str, the figure will be saved as ‘sctour_vector_field.png’ (if True provided) or a given filename (if a str provided).

  • kwargs – Parameters passed to scanpy.pl.embedding().

Return type

None