hv_anndata.plotting.scanpy.heatmap¶
- hv_anndata.plotting.scanpy.heatmap(adata, base=A.X, /, vdims=(), *, transpose=False, add_dendrogram=False)¶
Shortcut for a heatmap.
Basically just
>>> hv.HeatMap(adata, [A.obs.index, A.var.index], [base[:, :], *vdims]).opts(...)
Set
baseto e.g.AorA.layers[key], andtranspose=Trueto switch the order of the dims.If
add_dendrogramis True, the dendrogram is added. Call it directly to customize the dendrogram:>>> hv.operation.dendrogram(heatmap, adjoint_dims=..., main_dim=base[:, :])
- Parameters:
- adata
AnnData The AnnData object.
- base
LayerAcc|GraphAcc, default:A.X The base layer/graph of the heatmap.
- vdims
Collection[AdDim], default:() The value dimensions.
- transpose
bool, default:False Whether to transpose the dims.
- add_dendrogram
bool|Literal['obs','var'], default:False Where to add dendrograms to the heatmap:
Truefor both,"obs"/"var"for one, andFalsefor none.
- adata
- Return type:
- Returns:
A heatmap object
Examples
import hv_anndata.plotting.scanpy as hv_sc from hv_anndata import data, register, A register() adata = data.pbmc68k_processed() markers = ["C1QA", "PSAP", "CD79A", "CD79B", "CST3", "LYZ"] hv_sc.heatmap( adata[:, markers], A.X, [A.obs["n_counts"]], add_dendrogram="obs" ).opts(hv.opts.HeatMap(xticks=0, aspect=2))
/home/docs/.local/share/hatch/env/virtual/hv-anndata/STk7F69l/docs/lib/python3.13/site-packages/holoviews/operation/element.py:1365: FutureWarning: Probably comparing to a dimension created from `Dimension.name`. This will not be supported in the future, please report as an issue. if d not in self.p.adjoint_dims:
/home/docs/.local/share/hatch/env/virtual/hv-anndata/STk7F69l/docs/lib/python3.13/site-packages/holoviews/core/dimension.py:1033: FutureWarning: Probably comparing to a dimension created from `Dimension.name`. This will not be supported in the future, please report as an issue. dims = [d for d in all_dims if dimension == d] /home/docs/.local/share/hatch/env/virtual/hv-anndata/STk7F69l/docs/lib/python3.13/site-packages/holoviews/operation/element.py:1406: FutureWarning: Probably comparing to a dimension created from `Dimension.name`. This will not be supported in the future, please report as an issue. if dim not in self.p.adjoint_dims:
/home/docs/.local/share/hatch/env/virtual/hv-anndata/STk7F69l/docs/lib/python3.13/site-packages/holoviews/core/data/xarray.py:183: FutureWarning: Probably comparing to a dimension created from `Dimension.name`. This will not be supported in the future, please report as an issue. data = {d: np.asarray(values) if d in kdims else values /home/docs/.local/share/hatch/env/virtual/hv-anndata/STk7F69l/docs/lib/python3.13/site-packages/holoviews/core/data/xarray.py:230: FutureWarning: Probably comparing to a dimension created from `Dimension.name`. This will not be supported in the future, please report as an issue. if c in kdims or len(da[c].shape) != 1 or da[c].shape[0] <= 1: /home/docs/.local/share/hatch/env/virtual/hv-anndata/STk7F69l/docs/lib/python3.13/site-packages/holoviews/core/data/xarray.py:387: FutureWarning: Probably comparing to a dimension created from `Dimension.name`. This will not be supported in the future, please report as an issue. if dim in dataset.kdims: /home/docs/.local/share/hatch/env/virtual/hv-anndata/STk7F69l/docs/lib/python3.13/site-packages/holoviews/core/dimension.py:1073: FutureWarning: Probably comparing to a dimension created from `Dimension.name`. This will not be supported in the future, please report as an issue. return next(i for i, d in enumerate(dimensions) if d == dim)/home/docs/.local/share/hatch/env/virtual/hv-anndata/STk7F69l/docs/lib/python3.13/site-packages/holoviews/core/data/xarray.py:387: FutureWarning: Probably comparing to a dimension created from `Dimension.name`. This will not be supported in the future, please report as an issue. if dim in dataset.kdims: /home/docs/.local/share/hatch/env/virtual/hv-anndata/STk7F69l/docs/lib/python3.13/site-packages/holoviews/core/dimension.py:1073: FutureWarning: Probably comparing to a dimension created from `Dimension.name`. This will not be supported in the future, please report as an issue. return next(i for i, d in enumerate(dimensions) if d == dim)
/home/docs/.local/share/hatch/env/virtual/hv-anndata/STk7F69l/docs/lib/python3.13/site-packages/holoviews/core/data/xarray.py:387: FutureWarning: Probably comparing to a dimension created from `Dimension.name`. This will not be supported in the future, please report as an issue. if dim in dataset.kdims: /home/docs/.local/share/hatch/env/virtual/hv-anndata/STk7F69l/docs/lib/python3.13/site-packages/holoviews/core/dimension.py:1073: FutureWarning: Probably comparing to a dimension created from `Dimension.name`. This will not be supported in the future, please report as an issue. return next(i for i, d in enumerate(dimensions) if d == dim) /home/docs/.local/share/hatch/env/virtual/hv-anndata/STk7F69l/docs/lib/python3.13/site-packages/holoviews/core/data/xarray.py:387: FutureWarning: Probably comparing to a dimension created from `Dimension.name`. This will not be supported in the future, please report as an issue. if dim in dataset.kdims: /home/docs/.local/share/hatch/env/virtual/hv-anndata/STk7F69l/docs/lib/python3.13/site-packages/holoviews/core/dimension.py:1073: FutureWarning: Probably comparing to a dimension created from `Dimension.name`. This will not be supported in the future, please report as an issue. return next(i for i, d in enumerate(dimensions) if d == dim) /home/docs/.local/share/hatch/env/virtual/hv-anndata/STk7F69l/docs/lib/python3.13/site-packages/holoviews/core/data/grid.py:326: FutureWarning: Probably comparing to a dimension created from `Dimension.name`. This will not be supported in the future, please report as an issue. if d not in dataset.kdims+virtual_coords]
import hv_anndata.plotting.scanpy as hv_sc from hv_anndata import data, register, A register() adata = data.pbmc68k_processed() markers = ["C1QA", "PSAP", "CD79A", "CD79B", "CST3", "LYZ"] hv_sc.heatmap( adata[:, markers], A.X, [A.obs["n_counts"]], add_dendrogram="obs" ).opts(hv.opts.HeatMap(xticks=0, aspect=2))
/home/docs/.local/share/hatch/env/virtual/hv-anndata/STk7F69l/docs/lib/python3.13/site-packages/holoviews/operation/element.py:1365: FutureWarning: Probably comparing to a dimension created from `Dimension.name`. This will not be supported in the future, please report as an issue. if d not in self.p.adjoint_dims:
/home/docs/.local/share/hatch/env/virtual/hv-anndata/STk7F69l/docs/lib/python3.13/site-packages/holoviews/core/dimension.py:1033: FutureWarning: Probably comparing to a dimension created from `Dimension.name`. This will not be supported in the future, please report as an issue. dims = [d for d in all_dims if dimension == d] /home/docs/.local/share/hatch/env/virtual/hv-anndata/STk7F69l/docs/lib/python3.13/site-packages/holoviews/operation/element.py:1406: FutureWarning: Probably comparing to a dimension created from `Dimension.name`. This will not be supported in the future, please report as an issue. if dim not in self.p.adjoint_dims:
/home/docs/.local/share/hatch/env/virtual/hv-anndata/STk7F69l/docs/lib/python3.13/site-packages/holoviews/core/data/xarray.py:183: FutureWarning: Probably comparing to a dimension created from `Dimension.name`. This will not be supported in the future, please report as an issue. data = {d: np.asarray(values) if d in kdims else values /home/docs/.local/share/hatch/env/virtual/hv-anndata/STk7F69l/docs/lib/python3.13/site-packages/holoviews/core/data/xarray.py:230: FutureWarning: Probably comparing to a dimension created from `Dimension.name`. This will not be supported in the future, please report as an issue. if c in kdims or len(da[c].shape) != 1 or da[c].shape[0] <= 1: /home/docs/.local/share/hatch/env/virtual/hv-anndata/STk7F69l/docs/lib/python3.13/site-packages/holoviews/core/data/xarray.py:387: FutureWarning: Probably comparing to a dimension created from `Dimension.name`. This will not be supported in the future, please report as an issue. if dim in dataset.kdims: /home/docs/.local/share/hatch/env/virtual/hv-anndata/STk7F69l/docs/lib/python3.13/site-packages/holoviews/core/dimension.py:1073: FutureWarning: Probably comparing to a dimension created from `Dimension.name`. This will not be supported in the future, please report as an issue. return next(i for i, d in enumerate(dimensions) if d == dim)/home/docs/.local/share/hatch/env/virtual/hv-anndata/STk7F69l/docs/lib/python3.13/site-packages/holoviews/core/data/xarray.py:387: FutureWarning: Probably comparing to a dimension created from `Dimension.name`. This will not be supported in the future, please report as an issue. if dim in dataset.kdims: /home/docs/.local/share/hatch/env/virtual/hv-anndata/STk7F69l/docs/lib/python3.13/site-packages/holoviews/core/dimension.py:1073: FutureWarning: Probably comparing to a dimension created from `Dimension.name`. This will not be supported in the future, please report as an issue. return next(i for i, d in enumerate(dimensions) if d == dim) /home/docs/.local/share/hatch/env/virtual/hv-anndata/STk7F69l/docs/lib/python3.13/site-packages/holoviews/core/data/xarray.py:387: FutureWarning: Probably comparing to a dimension created from `Dimension.name`. This will not be supported in the future, please report as an issue. if dim in dataset.kdims: /home/docs/.local/share/hatch/env/virtual/hv-anndata/STk7F69l/docs/lib/python3.13/site-packages/holoviews/core/dimension.py:1073: FutureWarning: Probably comparing to a dimension created from `Dimension.name`. This will not be supported in the future, please report as an issue. return next(i for i, d in enumerate(dimensions) if d == dim)
/home/docs/.local/share/hatch/env/virtual/hv-anndata/STk7F69l/docs/lib/python3.13/site-packages/holoviews/core/data/xarray.py:387: FutureWarning: Probably comparing to a dimension created from `Dimension.name`. This will not be supported in the future, please report as an issue. if dim in dataset.kdims: /home/docs/.local/share/hatch/env/virtual/hv-anndata/STk7F69l/docs/lib/python3.13/site-packages/holoviews/core/dimension.py:1073: FutureWarning: Probably comparing to a dimension created from `Dimension.name`. This will not be supported in the future, please report as an issue. return next(i for i, d in enumerate(dimensions) if d == dim) /home/docs/.local/share/hatch/env/virtual/hv-anndata/STk7F69l/docs/lib/python3.13/site-packages/holoviews/core/data/grid.py:326: FutureWarning: Probably comparing to a dimension created from `Dimension.name`. This will not be supported in the future, please report as an issue. if d not in dataset.kdims+virtual_coords]
import hv_anndata.plotting.scanpy as hv_sc from hv_anndata import data, register, A register() adata = data.pbmc68k_processed() markers = ["C1QA", "PSAP", "CD79A", "CD79B", "CST3", "LYZ"] hv_sc.heatmap( adata[:, markers], A.X, [A.obs["n_counts"]], add_dendrogram="obs" ).opts(hv.opts.HeatMap(xticks=0, aspect=2))
/home/docs/.local/share/hatch/env/virtual/hv-anndata/STk7F69l/docs/lib/python3.13/site-packages/holoviews/operation/element.py:1365: FutureWarning: Probably comparing to a dimension created from `Dimension.name`. This will not be supported in the future, please report as an issue. if d not in self.p.adjoint_dims:
/home/docs/.local/share/hatch/env/virtual/hv-anndata/STk7F69l/docs/lib/python3.13/site-packages/holoviews/core/dimension.py:1033: FutureWarning: Probably comparing to a dimension created from `Dimension.name`. This will not be supported in the future, please report as an issue. dims = [d for d in all_dims if dimension == d] /home/docs/.local/share/hatch/env/virtual/hv-anndata/STk7F69l/docs/lib/python3.13/site-packages/holoviews/operation/element.py:1406: FutureWarning: Probably comparing to a dimension created from `Dimension.name`. This will not be supported in the future, please report as an issue. if dim not in self.p.adjoint_dims:
/home/docs/.local/share/hatch/env/virtual/hv-anndata/STk7F69l/docs/lib/python3.13/site-packages/holoviews/core/data/xarray.py:183: FutureWarning: Probably comparing to a dimension created from `Dimension.name`. This will not be supported in the future, please report as an issue. data = {d: np.asarray(values) if d in kdims else values /home/docs/.local/share/hatch/env/virtual/hv-anndata/STk7F69l/docs/lib/python3.13/site-packages/holoviews/core/data/xarray.py:230: FutureWarning: Probably comparing to a dimension created from `Dimension.name`. This will not be supported in the future, please report as an issue. if c in kdims or len(da[c].shape) != 1 or da[c].shape[0] <= 1: /home/docs/.local/share/hatch/env/virtual/hv-anndata/STk7F69l/docs/lib/python3.13/site-packages/holoviews/core/data/xarray.py:387: FutureWarning: Probably comparing to a dimension created from `Dimension.name`. This will not be supported in the future, please report as an issue. if dim in dataset.kdims: /home/docs/.local/share/hatch/env/virtual/hv-anndata/STk7F69l/docs/lib/python3.13/site-packages/holoviews/core/dimension.py:1073: FutureWarning: Probably comparing to a dimension created from `Dimension.name`. This will not be supported in the future, please report as an issue. return next(i for i, d in enumerate(dimensions) if d == dim)/home/docs/.local/share/hatch/env/virtual/hv-anndata/STk7F69l/docs/lib/python3.13/site-packages/holoviews/core/data/xarray.py:387: FutureWarning: Probably comparing to a dimension created from `Dimension.name`. This will not be supported in the future, please report as an issue. if dim in dataset.kdims: /home/docs/.local/share/hatch/env/virtual/hv-anndata/STk7F69l/docs/lib/python3.13/site-packages/holoviews/core/dimension.py:1073: FutureWarning: Probably comparing to a dimension created from `Dimension.name`. This will not be supported in the future, please report as an issue. return next(i for i, d in enumerate(dimensions) if d == dim) WARNING:param.LayoutPlot56113: Plotly plotting class for Empty type not found, object will not be rendered.
WARNING:param.LayoutPlot56113: Plotly plotting class for Dendrogram type not found, object will not be rendered.
/home/docs/.local/share/hatch/env/virtual/hv-anndata/STk7F69l/docs/lib/python3.13/site-packages/holoviews/core/data/grid.py:326: FutureWarning: Probably comparing to a dimension created from `Dimension.name`. This will not be supported in the future, please report as an issue. if d not in dataset.kdims+virtual_coords]