ehrapy.plot.pca_loadings(adata, components=None, include_lowest=True, show=None, save=None)[source]#

Rank features according to contributions to PCs.

  • adata (AnnData) – AnnData object object containing all observations.

  • components (str | Sequence[int] | None) – For example, '1,2,3' means [1, 2, 3], first, second, third principal component.

  • include_lowest (bool) – Whether to show the features with both highest and lowest loadings.

  • show (bool | None) – Show the plot, do not return axis.

  • save (str | 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’}.


If show==False a Axes or a list of it.


>>> 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)
>>> ep.pp.pca(adata)
>>>, components="1,2,3")