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)#
Plot arrows from source to target cells based on transcript proximity for a gene.
Source and target cells, and the transcript locations, are color-coded. An optional background image (e.g. a tissue section) can be overlaid behind the plot.
- Parameters:
sdata (
SpatialData) – Spatial data object containing the transcript and cell position data.layer (
str(default:'extracellular_transcripts_enriched')) – The layer insdata.pointsthat contains the extracellular RNA transcript data, withclosest_target_cellandclosest_source_cellcolumns.gene (
str(default:'Arc')) – The gene of interest.gene_key (
str(default:'feature_name')) – The column name used to identify the gene inlayer.cell_id_key (
str(default:'cell_id')) – The column name insdata["table"].obsused to identify individual cells.color_target (
str(default:'blue')) – Color for the target cells.color_source (
str(default:'red')) – Color for the source cells.color_transcript (
str(default:'green')) – Color for the transcript locations.spatial_key (
str(default:'spatial')) – The key insdata["table"].obsmthat stores the spatial coordinates of the cells.img (
Union[bool,Sequence,None] (default:None)) – Optional background image (e.g., tissue section) to display behind the plot.img_alpha (
Optional[float] (default:None)) – Transparency level for the background image. Ignored ifimgisNone.image_cmap (
Optional[Colormap] (default:None)) – Colormap for the background image.size (
float|Sequence[float] |None(default:8)) – Size of the plotted points (cells and transcripts).alpha (
float(default:0.6)) – Transparency level for the plotted points.title (
Union[str,Sequence[str],None] (default:None)) – Title of the plot. IfNone, the gene name is used.legend_loc (
str|None(default:'best')) – Location of the legend on the plot.figsize (
tuple[float,float] (default:(10, 10))) – Size of the plot.save (
Union[str,Path,None] (default:None)) – If provided, the path where the plot will be saved.kwargs – Additional arguments passed to
matplotlib.pyplot.scatter()andmatplotlib.pyplot.imshow().
- Return type:
- Returns:
None