pegasus.heatmap

pegasus.heatmap(data, genes, groupby, matkey=None, on_average=True, switch_axes=False, row_cluster=None, col_cluster=None, panel_size=(10, 10), return_fig=False, dpi=300.0, **kwargs)[source]

Generate a heatmap.

Parameters
  • data (AnnData or MultimodalData or UnimodalData object) – Single-cell expression data.

  • genes (str or List[str]) – Features to plot.

  • groupby (str) – A categorical variable in data.obs that is used to categorize the cells, e.g. Clusters.

  • matkey (str, optional, default: None) – If matkey is set, select matrix with matkey as keyword in the current modality. Only works for MultimodalData or UnimodalData objects.

  • on_average (bool, optional, default: True) – If True, plot cluster average gene expression (i.e. show a Matrixplot); otherwise, plot a general heatmap.

  • switch_axes (bool, optional, default: False) – By default, X axis is for genes, and Y axis for clusters. If this parameter is True, switch the axes. Moreover, with on_average being False, if switch_axes is False, row_cluster is enforced to be False; if switch_axes is True, col_cluster is enforced to be False.

  • row_cluster (bool, optional, default: False) – Cluster rows and generate a row-wise dendrogram.

  • col_cluster (bool, optional, default: True) – Cluster columns and generate a column-wise dendrogram.

  • panel_size (Tuple[float, float], optional, default: (10, 10)) – Overall size of the heatmap in (width, height) form.

  • return_fig (bool, optional, default: False) – Return a Figure object if True; return None otherwise.

  • dpi (float, optional, default: 300.0) – The resolution in dots per inch.

  • kwargs – Are passed to seaborn.heatmap.

  • _colormap documentation (.) –

Returns

A matplotlib.figure.Figure object containing the dot plot if return_fig == True

Return type

Figure object

Examples

>>> pg.heatmap(data, genes=['CD14', 'TRAC', 'CD34'], groupby='louvain_labels')