squidpy.pl.ligrec(adata, cluster_key=None, source_groups=None, target_groups=None, means_range=(-inf, inf), pvalue_threshold=1.0, remove_empty_interactions=True, remove_nonsig_interactions=False, dendrogram=None, alpha=0.001, swap_axes=False, title=None, figsize=None, dpi=None, save=None, **kwargs)[source]

Plot the result of a receptor-ligand permutation test.

The result was computed by squidpy.gr.ligrec().

\(molecule_1\) belongs to the source clusters displayed on the top (or on the right, if swap_axes = True, whereas \(molecule_2\) belongs to the target clusters.

  • adata (AnnData | Mapping[str, DataFrame]) – Annotated data object. It can also be a dict, as returned by squidpy.gr.ligrec().

  • cluster_key (Optional[str]) – Key in anndata.AnnData.obs where clustering is stored. Only used when adata is of type AnnData.

  • source_groups (Union[str, Sequence[str], None]) – Source interaction clusters. If None, select all clusters.

  • target_groups (Union[str, Sequence[str], None]) – Target interaction clusters. If None, select all clusters.

  • means_range (tuple[float, float]) – Only show interactions whose means are within this closed interval.

  • pvalue_threshold (float) – Only show interactions with p-value <= pvalue_threshold.

  • remove_empty_interactions (bool) – Remove rows and columns that only contain interactions with NaN values.

  • remove_nonsig_interactions (bool) – Remove rows and columns that only contain interactions that are larger than alpha.

  • dendrogram (Optional[str]) –

    How to cluster based on the p-values. Valid options are:

    • None - do not perform clustering.

    • ’interacting_molecules’ - cluster the interacting molecules.

    • ’interacting_clusters’ - cluster the interacting clusters.

    • ’both’ - cluster both rows and columns. Note that in this case, the dendrogram is not shown.

  • alpha (float | None) – Significance threshold. All elements with p-values <= alpha will be marked by tori instead of dots.

  • swap_axes (bool) – Whether to show the cluster combinations as rows and the interacting pairs as columns.

  • title (Optional[str]) – Title of the plot.

  • figsize (Optional[tuple[float, float]]) – Size of the figure in inches.

  • dpi (Optional[int]) – Dots per inch.

  • save (Union[str, Path, None]) – Whether to save the plot.

  • scalebar_kwargs – Keyword arguments for matplotlib_scalebar.ScaleBar().

  • edges_kwargs – Keyword arguments for networkx.draw_networkx_edges().

  • kwargs (Any) – Keyword arguments for matplotlib.pyplot.scatter() or matplotlib.pyplot.imshow().

  • kwargs – Keyword arguments for scanpy.pl.DotPlot.style() or scanpy.pl.DotPlot.legend().

Return type:



: Nothing, just plots the figure and optionally saves the plot.