interscale.evaluation.plot_all_spatial_net_streams#
- interscale.evaluation.plot_all_spatial_net_streams(adata, fov_id, fov_key='fov', window_key='sliding_window_assignment', cell_type_col='cell_type_coarse', grid_res=50, max_dist=None, k_dist=0.05, density=1.5, ax=None, additional_embeddings=None, return_streams=False, cell_list=None, inter_only=False, **kwargs)#
Visualize spatial interaction flows using streamplots overlaid on a spatial scatter plot.
This function coordinates the extraction of spatial metadata, computation of vector fields based on attention matrices, and the final rendering of directional flows (streams) for different cell types.
- Parameters:
adata (anndata.AnnData) – The complete AnnData object.
fov_id (str) – The specific Field of View to visualize.
fov_key (str) – Key in
adata.obsidentifying FOVs. Defaults to “fov”.window_key (str) – Key identifying local windows for flow computation.
cell_type_col (str) – Column in
adata.obswith cell type labels.grid_res (int) – Resolution of the interpolation grid. Defaults to 50.
max_dist (float) – Maximum influence distance for vectors. If None, calculated via
k_dist.k_dist (float) – Fraction of the FOV width to use as
max_distifmax_distis None.density (float) – Density of the streamplot lines. Defaults to 1.5.
ax (matplotlib.axes.Axes) – Pre-existing axes for plotting.
additional_embeddings (str) – Additional color mapping for the background scatter plot.
return_streams (bool) – If True, returns the computed vector fields instead of plotting.
cell_list (list) – Subset of cell types to include in the flow analysis.
inter_only (bool) – If True, excludes self-interactions from the vector fields.
**kwargs – Passed to
squidpy.pl.spatial_scatter.
- Returns:
ax : matplotlib.axes.Axes or dict The plot axes, or a dictionary of vector fields if
return_streamsis True.