ehrapy.plot.ranking

Contents

ehrapy.plot.ranking#

ehrapy.plot.ranking(edata, attr, keys, dictionary=None, indices=None, labels=None, color='black', n_points=30, log=False, include_lowest=False, show=None)[source]#

Plot rankings.

See, for example, how this is used in pl.pca_loadings.

Parameters:
  • edata (EHRData) – Central data object.

  • attr (Literal['var', 'obs', 'uns', 'varm', 'obsm']) – The attribute of the object that contains the score.

  • keys (str | Sequence[str]) – The scores to look up an array from the attribute of edata.

  • dictionary (default: None) – Optional key dictionary.

  • indices (default: None) – Optional dictionary indices.

  • labels (default: None) – Optional labels.

  • color (default: 'black') – Optional primary color (default: black).

  • n_points (default: 30) – Number of points (default: 30).

  • log (default: False) – Whether logarithmic scale should be used.

  • include_lowest (default: False) – Whether to include the lowest points.

  • show (default: None) – Whether to show the plot.

Returns:

Returns matplotlib gridspec with access to the axes.

Example

import ehrapy as ep

edata = ed.dt.mimic_2()
ep.pp.knn_impute(edata)
ep.pp.log_norm(edata, offset=1)
ep.pp.neighbors(edata)
ep.pp.pca(edata)