scanpy.pl.clustermap

scanpy.pl.clustermap(adata, obs_keys=None, use_raw=None, show=None, save=None, **kwds)

Hierarchically-clustered heatmap.

Wraps seaborn.clustermap for AnnData.

Parameters
adata : AnnData

Annotated data matrix.

obs_keys : str

Categorical annotation to plot with a different color map. Currently, only a single key is supported.

use_raw : bool, optional (default: None)

Use raw attribute of adata if present.

show

Show the plot, do not return axis.

save

If True or a str, save the figure. A string is appended to the default filename. Infer the filetype if ending on {‘.pdf’, ‘.png’, ‘.svg’}.

ax

A matplotlib axes object. Only works if plotting a single component.

**kwds : keyword arguments

Keyword arguments passed to seaborn.clustermap.

Returns

If show == False, a seaborn.ClusterGrid object.

Notes

The returned object has a savefig() method that should be used if you want to save the figure object without clipping the dendrograms.

To access the reordered row indices, use: clustergrid.dendrogram_row.reordered_ind

Column indices, use: clustergrid.dendrogram_col.reordered_ind

Examples

Soon to come with figures. In the meanwile, see https://seaborn.pydata.org/generated/seaborn.clustermap.html.

>>> import scanpy.api as sc
>>> adata = sc.datasets.krumsiek11()
>>> sc.pl.clustermap(adata, obs_keys='cell_type')