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 containing all observations.method (
str
, default:'average'
) – The distance measure being used for clustering. This parameter is passed to scipy.hierarchy.filter (
str
|None
, default:None
) – The filter to apply to the dendrogram. Should be one of “top”, “bottom”, or None.max_cols (
int
, default:0
) – The max number of columns from the AnnData object to include.max_percentage (
float
, default:0
) – The max percentage fill of the columns from the AnnData object.figsize (
tuple
|None
, default:None
) – The size of the figure to display.fontsize (
float
, default:16
) – The figure’s font size.orientation (
str
|None
, default:None
) – The way the dendrogram is oriented.label_rotation (
float
, default:45
) – What angle to rotate the text labels to. .categoricals (
bool
, default:False
) – 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: