ehrapy.plot.rank_features_groups(adata, groups=None, n_features=20, feature_symbols=None, key='rank_features_groups', fontsize=8, ncols=4, share_y=True, show=None, save=None, ax=None, **kwds)[source]#

Plot ranking of features.

  • adata (AnnData) – Annotated data matrix.

  • groups (str | Sequence[str]) – The groups for which to show the feature ranking.

  • n_features (int) – The number of features to plot.

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

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

  • fontsize (int) – Fontsize for feature names.

  • ncols (int) – Number of panels shown per row.

  • share_y (bool) – Controls if the y-axis of each panels should be shared. But passing sharey=False, each panel has its own y-axis range.

  • 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")