liana.plotting.lric_lineplot#
- liana.plotting.lric_lineplot(radii, curves, *, overlay=False, ncols=4, colors=None, title=None, figure_size=None, ax=None, return_fig=True)#
Line plot for cross-PCF / LRIC g(r) curves with a baseline at 1.
- Parameters:
radii – 1-D array of radius values shared by all curves. Individual curves may supply their own radii by passing
(radii, g)tuples as values.curves (
dict) –{label: g}or{label: (radii, g)}. In small-multiples mode labels become subplot titles; in overlay mode they become legend entries.overlay (
bool(default:False)) –False(default) — one subplot per curve arranged in a grid.True— all curves drawn on a single axis.ncols (
int(default:4)) – Number of columns for the small-multiples grid (ignored whenoverlay=True).colors (default:
None) – Colour specification. Accepts a single colour string (applied to all curves), a list (one per curve, in dict-insertion order), or a dict keyed by label. Defaults to the matplotlib tab10 cycle.title (
str|None(default:None)) – Figure-level super-title.figure_size (
tuple|None(default:None)) – Figure x,y sizeax (default:
None) – ExistingAxesto draw into. Only used whenoverlay=True; ignored otherwise.return_fig (
bool(default:True)) –boolwhether to return the fig object.
- Return type:
Figure|None- Returns:
Figureifreturn_figisTrue, otherwiseNone.
Examples
radiiand the curves come fromliana.method.cross_pcf(cell-type co-localisation) orliana.method.lric(expression-weighted). The dotted line atg(r) = 1marks spatial independence:>>> import liana as li >>> adata = li.testing.generate_toy_spatial() >>> res = li.mt.cross_pcf(adata, groupby='bulk_labels', ... radius_step=50, annulus_width=50, ... inplace=False) >>> curves = {f'{s} -> {r}': g ... for (s, r), g in list(res['results'].items())[:2]} >>> fig = li.pl.lric_lineplot(res['radii'], curves, overlay=True)
One subplot per curve without
overlay.