liana.plotting.annulus_plot

Contents

liana.plotting.annulus_plot#

liana.plotting.annulus_plot(adata, spatial_key='spatial', annulus_width=20.0, radius_step=20.0, extend_first_annulus=True, n_rings=10, seed=1337, figure_size=(6, 6))#

Visualise concentric annuli around a randomly chosen cell on a tissue section.

Useful for inspecting the local neighbourhood structure and choosing sensible radius_step / annulus_width parameters before running spatial statistics (e.g. cross-PCF or LRIC).

Parameters:
  • adata (AnnData) – Annotated data object.

  • spatial_key (str (default: 'spatial')) – Key in adata.obsm that contains the spatial coordinates. Default is 'spatial'.

  • annulus_width (float (default: 20.0)) – Radial width of each annulus ring (in coordinate units, e.g. µm). Setting annulus_width == radius_step avoids double-counting.

  • radius_step (float (default: 20.0)) – Step size between successive ring inner radii (in the same units as the spatial coordinates).

  • extend_first_annulus (bool (default: True)) – If True (default), draw the innermost ring from radius 0 (spanning [0, radius_step + annulus_width)) to mirror the merged first bin used by liana.mt.lric() / liana.mt.cross_pcf(). False starts the first ring at radius_step.

  • n_rings (int (default: 10)) – Number of concentric rings to draw.

  • seed (int (default: 1337)) – Random seed for reproducibility.

  • figure_size (tuple (default: (6, 6))) – Figure x,y size

Raises:

KeyError – If spatial_key is not found in adata.obsm.

Return type:

None