troutpy.pl.intra_extra_density

troutpy.pl.intra_extra_density#

troutpy.pl.intra_extra_density(sdata, genes, layer='transcripts', gene_key='feature_name', coord_keys=None, intra_kde_kwargs=None, extra_kde_kwargs=None, figsize=None)#

Plot KDEs of the spatial distribution of intracellular and extracellular transcripts for a list of genes.

Each gene is displayed in a separate row with intracellular and extracellular KDEs in side-by-side subplots.

Parameters:
  • sdata (SpatialData) – Spatial data object containing transcript locations and metadata.

  • genes (list[str]) – Gene names to plot.

  • layer (str (default: 'transcripts')) – Layer within sdata where transcripts are stored.

  • gene_key (str (default: 'feature_name')) – Column name where the gene name is stored.

  • coord_keys (Optional[list[str]] (default: None)) – Column names for spatial coordinates. If None, defaults to ["x", "y"].

  • intra_kde_kwargs (Optional[dict] (default: None)) – Optional arguments for seaborn.kdeplot() for intracellular data.

  • extra_kde_kwargs (Optional[dict] (default: None)) – Optional arguments for seaborn.kdeplot() for extracellular data.

  • figsize (Optional[tuple[float, float]] (default: None)) – Size of the figure. If None, computed automatically based on the number of genes.

Return type:

None

Returns:

None