Plotting (sdq.pl)#
sdq.pl.velocity_stream
- scdiffeq.plotting._velocity_stream.velocity_stream(adata: AnnData, ax: Axes | List[Axes] | None = None, c: str = 'dodgerblue', cmap: Dict | List | Tuple | None = 'plasma_r', group_zorder: Dict | None = None, linewidth: float = 0.5, stream_density: float = 2.5, add_margin: float = 0.1, arrowsize: float = 1, arrowstyle: str = '-|>', maxlength: float = 4, integration_direction: str = 'both', scatter_zorder: int = 101, stream_zorder: int = 201, density: float = 1, smooth: float = 0.5, n_neighbors: int | None = None, min_mass: float = 1, autoscale=True, stream_adjust=True, cutoff_percentile: float = 0.05, velocity_key: str = 'velocity', self_transitions: bool = True, use_negative_cosines: bool = True, T_scale: float = 10, disable_scatter: bool = False, disable_cbar: bool = False, stream_kwargs: Dict[str, Any] | None = {}, scatter_kwargs: Dict[str, Any] | None = {}, cbar_kwargs: Dict | None = {}, mpl_kwargs: Dict[str, Any] | None = {}, return_axes: bool = False, save: bool | None = False, rasterized: bool = True, png_dpi: float | None = 500, svg_dpi: float | None = 250, *args, **kwargs) List[Axes] | None[source]
Generates velocity stream plots for single-cell data using the VelocityStreamPlot class.
This function is a convenient wrapper around the VelocityStreamPlot class, allowing users to quickly generate and customize velocity stream plots without manually instantiating the class.
- Parameters:
adata (AnnData) – The AnnData object containing the data to plot.
ax (Optional[Union[plt.Axes, List[plt.Axes]]], optional) – Matplotlib axes object or list of axes objects on which to draw the plots. If None, a new figure and axes are created. Default:
None.c (str, optional) – Color for the scatter plot points. Can be a column name from adata.obs if coloring by a categorical variable. Default:
"dodgerblue".cmap (Optional[Union[Dict, List, Tuple, str]], optional) – Colormap for the scatter plot points if c is a categorical variable. Default:
"plasma_r".group_zorder (Optional[Dict], optional) – Z-order for groups in the scatter plot, allowing certain groups to be plotted on top of others. Default:
None.linewidth (float, optional) – Line width for the streamlines. Default:
0.5.stream_density (float, optional) – Density of the streamlines. Higher values create more densely packed streamlines. Default:
2.5.add_margin (float, optional) – Additional margin added around the plotted data, specified as a fraction of the data range. Default:
0.1.arrowsize (float, optional) – Size of the arrows in the stream plot. Default:
1.arrowstyle (str, optional) – Style of the arrows in the stream plot. Default:
"-|>".maxlength (float, optional) – Maximum length of the arrows in the stream plot. Default:
4.integration_direction (str, optional) – Direction of integration for the streamlines, can be “forward”, “backward”, or “both”. Default:
"both".scatter_zorder (int, optional) – Z-order for scatter plot points, determining their layering. Default:
101.stream_zorder (int, optional) – Z-order for the streamlines, determining their layering. Default:
201.density (float, optional) – Default:
1.smooth (float, optional) – Default:
0.5.n_neighbors (Optional[int], optional) – Default:
None.min_mass (float, optional) – Default:
1.autoscale (bool, optional) – Default:
True.stream_adjust (bool, optional) – Default:
True.cutoff_percentile (float, optional)
velocity_key (str, optional)
self_transitions (bool, optional)
use_negative_cosines (bool, optional)
T_scale (float, optional)
disable_scatter (bool, optional) – If True, disables the scatter plot overlay on the stream plot. Default:
False.disable_cbar (bool, optional) – If True, disables the color bar for the scatter plot. Useful when c is numeric. Default:
False.stream_kwargs (Optional[Dict[str, Any]], optional)
scatter_kwargs (Optional[Dict[str, Any]], optional)
cbar_kwargs (Optional[Dict], optional)
mpl_kwargs (Optional[Dict[str, Any]], optional) – Additional keyword arguments for customizing the stream plot, scatter plot, color bar, and matplotlib figure, respectively.
return_axes (bool, optional) – If True, returns the matplotlib axes with the generated plots. Default:
False.save (bool, optional) – If True, saves the generated plot to SVG and PNG formats. Default:
False.png_dpi (Optional[float], optional) – DPI settings for saving PNG images. Default:
500.svg_dpi (Optional[float], optional) – DPI settings for saving SVG images. Default:
250.
- Returns:
A list of matplotlib axes with the generated plots, if
return_axes == True. Otherwise, returnsNone.- Return type:
Optional[Union[List[plt.Axes], None]]