troutpy.pl.interactions_with_arrows#
- troutpy.pl.interactions_with_arrows(sdata, layer='extracellular_transcripts_enriched', gene='Arc', gene_key='feature_name', cell_id_key='cell_id', color_target='blue', color_source='red', color_transcript='green', spatial_key='spatial', img=None, img_alpha=None, image_cmap=None, size=8, alpha=0.6, title=None, legend_loc='best', figsize=(10, 10), dpi=100, save=None, **kwargs)#
The function plots arrows from source to target cells based on transcript proximity, color-coding source and target cells, and transcript locations. An optional image layer can be overlaid behind the plot.
- Parameters:
sdata (spatialdata.SpatialData) – The AnnData object containing the spatial omics data.
layer (str) – The key in
sdatafor the extracellular transcript layer to analyze. Default is ‘extracellular_transcripts_enriched’.gene (str) – The gene of interest. Default is ‘Arc’.
gene_key (str) – The key for gene names in the data. Default is ‘feature_name’.
cell_id_key (str) – The key for cell IDs. Default is ‘cell_id’.
color_target (str) – Color for the target cells. Default is ‘blue’.
color_source (str) – Color for the source cells. Default is ‘red’.
color_transcript (str) – Color for the transcript locations. Default is ‘green’.
spatial_key (str) – The key for spatial coordinates in
sdata. Default is ‘spatial’.img (
Union[bool,Sequence,None] (default:None)) – Optional background image (e.g., tissue section) to display behind the plot.img_alpha (float) – Transparency level for the background image. Default is None (no image).
image_cmap (str) – Colormap for the image. Default is None.
size (float) – Size of the plotted points (cells and transcripts). Default is 8.
alpha (float) – Transparency level for plotted points. Default is 0.6.
title (str) – Title of the plot. Default is the gene name.
legend_loc (str) – Location of the legend on the plot. Default is ‘best’.
figsize (tuple) – Size of the plot. Default is (10, 10).
dpi (int) – Resolution of the plot. Default is 100.
save (str) – If provided, the path where the plot will be saved.
kwargs – Additional arguments passed to the
scatterandimshowfunctions for customization.
- Returns:
None The function displays or saves a plot of interactions between cells and transcripts.