troutpy.pl.global_distribution_from_source#
- troutpy.pl.global_distribution_from_source(sdata, cluster_key='kmeans_from_distribution', gene_key='gene', distance_key='distance', n_bins=20, how='full')#
Plots either (1) A clustermap of all genes’ distance distributions, sorted by cluster, with row colors, (2) A collapsed clustermap showing the mean distribution per cluster, with color-coded labels. (3) A line plot showing the mean distribution for each cluster, if ‘how’ is ‘lineplot’.
- Parameters:
sdata (spatialdata.SpatialData) – Spatial data object containing ‘source_score’ and ‘xrna_metadata’ layers.
cluster_key (str) – Column in sdata[‘xrna_metadata’].var containing cluster assignments.
gene_key (str) – Column that contains gene names.
distance_key (str) – Column that contains the distances.
n_bins (int) – Number of bins for the histogram representation.
how (str) –
“full”: Show clustermap of all genes, sorted by cluster, with row colors.
”collapsed”: Show clustermap of mean distribution per cluster, with color-coded labels.
”lineplot”: Show a line plot of the collapsed distributions per cluster.