ehrapy.plot.missing_values_matrix

ehrapy.plot.missing_values_matrix(adata, *, filter=None, max_cols=0, max_percentage=0, sort=None, figsize=(25, 10), width_ratios=(15, 1), color=(0.25, 0.25, 0.25), fontsize=16, labels=True, label_rotation=45, sparkline=True, categoricals=False)[source]

A matrix visualization of the nullity of the given AnnData object.

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

  • filter (str | None, default: None) – The filter to apply to the matrix. 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.

  • sort (str | None, default: None) – The row sort order to apply. Can be “ascending”, “descending”, or None.

  • figsize (tuple, default: (25, 10)) – The size of the figure to display.

  • width_ratios (tuple, default: (15, 1)) – The ratio of the width of the matrix to the width of the sparkline.

  • color (tuple, default: (0.25, 0.25, 0.25)) – The color of the filled columns.

  • fontsize (float, default: 16) – The figure’s font size.

  • labels (bool, default: True) – Whether or not to display the column names.

  • label_rotation (float, default: 45) – What angle to rotate the text labels to.

  • sparkline (bool, default: True) – Whether or not to display the sparkline.

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

Returns:

The plot axis.

Examples

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