stlearn.pl.lr_plot

stlearn.pl.lr_plot(adata: AnnData, lr: str, min_expr: float = 0, sig_spots=True, use_label: Optional[str] = None, outer_mode: str = 'continuous', l_cmap=None, r_cmap=None, lr_cmap=None, inner_cmap=None, inner_size_prop: float = 0.25, middle_size_prop: float = 0.5, outer_size_prop: float = 1, pt_scale: int = 100, title='', show_image: bool = True, show_arrows: bool = False, fig: Optional[Figure] = None, ax: Optional[Axes] = None, arrow_head_width: float = 4, arrow_width: float = 0.001, arrow_cmap: Optional[str] = None, arrow_vmax: Optional[float] = None, sig_cci: bool = False, lr_colors: Optional[dict] = None, figsize: tuple = (6.4, 4.8), use_mix: Optional[bool] = None, **kwargs) Optional[AnnData][source]
Creates different kinds of spatial visualisations for the LR analysis results.

To see combinations of parameters refer to stLearn CCI tutorial.

Parameters:
  • adata (Anndata) – Data on which st.tl.cci.run has been performed; extra options unlocked below when have performed st.tl.cci.run_cci as well.

  • lr (str) – The LR to display results for.

  • min_expr (float) – The minimum expr above which LR considered expressed when plotting binary LR expression.

  • sig_spots (bool) – Whether to subset to significant spots or not.

  • use_label (str) – The cell type labels to use if plotting cell types.

  • outer_mode (str) – The mode for the larger points when displaying LR expression; can either be ‘binary’ or ‘continuous’ or None. ‘Binary’ discretizes each spot as expressing L, R, both, or neither. ‘Continuous’ shows color gradient for levels of LR expression by plotting two points for each spot, the ‘inner’ point is the receptor expression levels, and the ‘outer’ point is the ligand expression level. None plots no ligand/receptor expression.

  • l_cmap (str) – Cmap for coloring the ligand expression, only if outer_mode==’continuous’.

  • r_cmap (str) – Cmap for coloring the receptor expression, only if outer_mode==’continuous’.

  • lr_cmap (str) – Cmap for coloring coexpression.

  • inner_cmap (str) – Cmap for the inner point if outer_mode is ‘binary’.

  • inner_size_prop (float) – Proportion of the inner point size when plotting to points for one spot. Scale of 0 to 1.

  • middle_size_prop (float) – Controls size of middle point if specifying parameters that plot 3 points per spot to display multiple information. Scale 0 to 1.

  • outer_size_prop (float) – Point size of the outer point.

  • pt_scale (float) – Overall size of point.

  • title (str) – Title of figure.

  • show_image (bool) – Whether to show the background image.

  • show_arrows (bool) – Whether to plot arrows indicating interactions between spots.

  • fig (Figure) – Figure to draw on.

  • ax (Axes) – Axes to draw on.

  • arrow_head_width (float) – Width of arrow head; only if show_arrows is true.

  • arrow_width (float) – Width the the arrow body; only if show_arrows is true.

  • arrow_cmap (float) – Cmap to color arrows; default is black arrows, but if specified will color the arrow by the average expression of the ligand and receptor of the spots connected by the arrow.

  • arrow_vmax (float) – Maximum value of the arrow colour bar.

  • sig_cci (bool) – Whether to only show results which involve signficant celltype-celltype interactions; particularly relevant when plotting the arrows.

  • lr_colors (dict) – Specifies the colors of the LRs when plotting with outer_mode=’binary’; structures is {‘l’: color, ‘r’: color, ‘lr’: color, ‘’: color}; the last key-value indicates colour for spots not expressing the ligand or receptor.

  • figsize (tuple) – (width, height) of figure if not inputted.

  • kwargs – Extra arguments parsed to plotting functions used internally.