liana.pl.connectivity#
- liana.pl.connectivity(adata, idx, spatial_key='spatial', connectivity_key='spatial_connectivities', size=1, figure_size=(5.4, 5), return_fig=True)#
Plot spatial connectivity weights.
- Parameters:
- adata
AnnData Annotated data object.
- idx
int Column index of the connectivity weights to plot.
- spatial_key
str(default:'spatial') Key in
adata.obsmthat contains the spatial coordinates.- connectivity_key
str(default:'spatial_connectivities') Key in
adata.obspthat contains the spatial connectivity matrix. Default is'spatial_connectivities'.- size
float(default:1) Size of the points
- figure_size
tuple[float,float] (default:(5.4, 5)) Figure x,y size
- return_fig
bool(default:True) boolwhether to return the fig object.
- adata
- Return type:
- Returns:
The resulting connectivity plot.
- Raises:
AssertionError – If
connectivity_keyorspatial_keyare not inadata.obsporadata.obsmrespectively.
Examples
idxpicks one spot, and the plot shows how strongly every other spot is connected to it under the kernel ofliana.pp.spatial_neighbors():>>> import liana as li >>> adata = li.ds.generate_toy_spatial() >>> p = li.pl.connectivity(adata, idx=0)