liana.pl.misty_contributions#
- liana.pl.misty_contributions(misty=None, target_metrics=None, view_names=None, filter_fn=None, aggregate_fn=None, figure_size=(5, 5), return_fig=True)#
Plot view contributions per target.
- Parameters:
- misty
MistyData|None(default:None) MistyData object with modelling results
- target_metrics
DataFrame|None(default:None) A target_metrics DataFrame
- view_names
list[str] |None(default:None) A list of view names to plot
- filter_fn
Callable[[Series],bool] |None(default:None) A function, applied along the columns (axis=1) of the results, used to filter the results to be plotted. In
dotplotandtileplotit selects interactions rather than rows: an interaction (ligand_complex->receptor_complex) is kept whenever the predicate holds for any of its source-target pairs, and is then plotted for all of them, so rows that fail the predicate are drawn alongside those that pass.circleand the misty plots filter row-wise.- aggregate_fn
Callable[[Series],object] |str|None(default:None) A function used to aggregate the results to be plotted.
- figure_size
tuple[float,float] (default:(5, 5)) Figure x,y size
- return_fig
bool(default:True) boolwhether to return the fig object.
- misty
- Return type:
- Returns:
A plotnine plot.
- Raises:
ValueError – If the
mistyinput is not valid or noview_namesprovided.
Examples
Stacks each view’s contribution to every target into one bar, read from
misty.uns['target_metrics']:>>> import liana as li >>> adata = li.ds.generate_toy_spatial() >>> adata = adata[:, adata.var_names[:5]].copy() >>> misty = li.mt.genericMistyData(intra=adata, bandwidth=200, set_diag=True) >>> misty(model=li.mt.sp.LinearModel) >>> p = li.pl.misty_contributions(misty)