ehrapy.plot.missing_values_dendrogram#
- ehrapy.plot.missing_values_dendrogram(edata, *, method='average', filter=None, max_cols=0, max_percentage=0, orientation=None, figsize=None, fontsize=16, label_rotation=45, categoricals=False, layer=None)[source]#
Fits a scipy hierarchical clustering algorithm 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:
edata (
EHRData) – Central data object.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 data object to include.max_percentage (
float, default:0) – The max percentage fill of the columns from the data 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 ehrdata as ed >>> import ehrapy as ep >>> edata = ed.dt.mimic_2() >>> ep.pl.missing_values_dendrogram(edata, filter="bottom", max_cols=15, max_percentage=0.999)
- Preview: