squidpy.pl.ligrec

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.

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

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

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

  • target_groups (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 (str | None) –

    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 (str | None) – Title of the plot.

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

  • dpi (int | None) – Dots per inch.

  • save (str | Path | None) – Whether to save the plot.

  • scalebar_kwargs – Keyword arguments for matplotlib_scalebar.ScaleBar.

  • edges_kwargs – Keyword arguments for networkx.drawing.nx_pylab.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:

None

Returns:

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