liana.plotting.feature_by_group#
- liana.plotting.feature_by_group(adata=None, groupby=None, spatial_key='spatial', labels=None, feature=None, figure_size=(10, 6), normalize=True, percentile_scaling=None, show_counts=True, **kwargs)#
Plot inflow scores for single feature across spatial coordinates.
- Parameters:
adata (
AnnData(default:None)) – Annotated data object.groupby (
str(default:None)) – Key to be used for grouping.spatial_key (default:
'spatial') – Key inadata.obsmthat contains the spatial coordinates. Default is'spatial'.labels (
list[str] (default:None)) – List of labels to compare, from groupby.feature (
str(default:None)) – From adata.var_names.figure_size (
tuple(default:(10, 6))) – Figure x,y sizenormalize (
bool(default:True)) – Normalize expression values between 0 and 1 for each cell type.percentile_scaling (
tuple[int,int] |None(default:None)) – Tuple specifying percentiles for scaling.show_counts (
bool(default:True)) – Show counts of expression cells (expression > 0).
- Returns:
A tuple of the matplotlib
Figureand its mainAxes.
Examples
adatais typically the output ofliana.method.inflow, whosevar_namesare'source^ligand^receptor'triplets. Each label inlabelsgets its own colormap and colorbar, so the groups can be compared in place:>>> import liana as li >>> adata = li.testing.generate_toy_spatial() >>> lrdata = li.mt.inflow(adata, groupby='bulk_labels', ... resource_name='consensus') >>> fig, ax = li.pl.feature_by_group(lrdata, ... groupby='bulk_labels', ... labels=['Dendritic', 'CD14+ Monocyte'], ... feature=lrdata.var_names[0])