ehrapy.plot.rank_features_groups_violin(adata, groups=None, n_features=20, feature_names=None, feature_symbols=None, key=None, split=True, scale='width', strip=True, jitter=True, size=1, ax=None, show=None, save=None)[source]#

Plot ranking of features for all tested comparisons as violin plots.

  • adata (AnnData) – Annotated data matrix.

  • groups (Sequence[str] | None) – List of group names.

  • n_features (int) – Number of features to show. Is ignored if feature_names is passed.

  • feature_names (Iterable[str] | None) – List of features to plot. Is only useful if interested in a custom feature list, which is not the result of

  • feature_symbols (str | None) – Key for field in .var that stores feature symbols if you do not want to use .var_names displayed in the plot.

  • key (str | None) – The key of the calculated feature group rankings (default: ‘rank_features_groups’).

  • split (bool) – Whether to split the violins or not.

  • scale (str) – See violinplot().

  • strip (bool) – Show a strip plot on top of the violin plot.

  • jitter (int | float | bool) – If set to 0, no points are drawn. See stripplot().

  • size (int) – Size of the jitter points.

  • show (bool | None) – Whether to display the figure or return axis.

  • save (bool | None) – If True or a str, save the figure. A string is appended to the default filename. Infer the filetype if ending on {‘.pdf’, ‘.png’, ‘.svg’}.

  • ax (Axes | None) – A matplotlib axes object. Only works if plotting a single component.


>>> import ehrapy as ep
>>> adata = ep.dt.mimic_2(encoded=True)
>>> ep.pp.knn_impute(adata)
>>> ep.pp.log_norm(adata, offset=1)
>>> ep.pp.neighbors(adata)
>>>, resolution=0.15, key_added="leiden_0_5")
>>>, groupby="leiden_0_5")
>>>, key="rank_features_groups", n_features=5)
../../_images/rank_features_groups_violin_1.png ../../_images/rank_features_groups_violin_2.png ../../_images/rank_features_groups_violin_3.png ../../_images/rank_features_groups_violin_4.png