pegasus.heatmap¶
- pegasus.heatmap(data, attrs, groupby, matkey=None, on_average=True, switch_axes=False, attrs_cluster=False, attrs_dendrogram=True, groupby_cluster=True, groupby_dendrogram=True, attrs_labelsize=10.0, groupby_labelsize=10.0, cbar_labelsize=10.0, panel_size=(10, 10), return_fig=False, dpi=300.0, **kwargs)[source]¶
Generate a heatmap.
- Parameters
data (
AnnDataorMultimodalDataorUnimodalDataobject) – Single-cell expression data.attrs (
strorList[str]) – Cell attributes or features to plot. Cell attributes must exist indata.obsand must be numeric. Features must exist indata.var. By default, attrs are plotted as columns.groupby (
str) – A categorical variable in data.obs that is used to categorize the cells, e.g. Clusters. By default, data.obs[‘groupby’] is plotted as rows.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) – IfTrue, 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 attributes, and Y axis for clusters. If this parameter isTrue, switch the axes. Moreover, withon_averagebeingFalse, ifswitch_axesisFalse,row_clusteris enforced to beFalse; ifswitch_axesisTrue,col_clusteris enforced to beFalse.attrs_cluster (
bool, optional, default:False) – Cluster attributes and generate a attribute-wise dendrogram.attrs_dendrogram (
bool, optional, default:True) – Only matters if attrs_cluster is True. Show the dendrogram if this option is True.groupby_cluster (
bool, optional, default:True) – Cluster data.obs[‘groupby’] and generate a cluster-wise dendrogram.groupby_dendrogram (
bool, optional, default:True) – Only matters if groupby_cluster is True. Show the dendrogram if this option is True.attrs_labelsize (
float, optional, default: 10.0) – Fontsize for labels of attrs.groupby_labelsize (
float, optional, default: 10.0) – Fontsize for labels of data.obs[‘groupby’].cbar_labelsize (
float, optional, default: 10.0) – Fontsize of the color bar.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 aFigureobject ifTrue; returnNoneotherwise.dpi (
float, optional, default:300.0) – The resolution in dots per inch.kwargs – Are passed to
seaborn.heatmap.documentation (.. _colormap) –
- Returns
A
matplotlib.figure.Figureobject containing the dot plot ifreturn_fig == True- Return type
Figureobject
Examples
>>> pg.heatmap(data, genes=['CD14', 'TRAC', 'CD34'], groupby='louvain_labels')