ehrapy.plot.missing_values_dendrogram

ehrapy.plot.missing_values_dendrogram(adata, *, method='average', filter=None, max_cols=0, max_percentage=0, orientation=None, figsize=None, fontsize=16, label_rotation=45, categoricals=False)[source]

Fits a scipy hierarchical clustering algorithm to the given AnnData object’s var and visualizes the results as a scipy dendrogram.

The default vertical display will fit up to 50 columns. If more than 50 columns are specified and orientation is left unspecified the dendrogram will automatically swap to a horizontal display to fit the additional variables.

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

  • method (str) – The distance measure being used for clustering. This parameter is passed to scipy.hierarchy.

  • filter (str | None) – The filter to apply to the dendrogram. Should be one of “top”, “bottom”, or None. Defaults to None .

  • max_cols (int) – The max number of columns from the AnnData object to include.

  • max_percentage (float) – The max percentage fill of the columns from the AnnData object.

  • figsize (tuple | None) – The size of the figure to display.

  • fontsize (float) – The figure’s font size.

  • orientation (str | None) – The way the dendrogram is oriented.

  • label_rotation (float) – What angle to rotate the text labels to. .

  • categoricals (bool) – Whether to include “ehrapycat” columns to the plot.

Returns:

The plot axis.

Example

>>> import ehrapy as ep
>>> adata = ep.dt.mimic_2(encoded=True)
>>> ep.pl.missing_values_dendrogram(adata, filter="bottom", max_cols=15, max_percentage=0.999)
Preview:
../../_images/missingno_dendrogram.png