Klar

Charts / React science and statistics charts / Relationship

Clustered heatmap

A matrix reordered by hierarchical clustering of rows and columns, with dendrograms, z-scored colour and sample annotation strips.

React component ClusteredHeatmap, data through props. How variables move together: correlation, density and many dimensions at once. Tags: heatmap, clustering, dendrogram, gene-expression, z-score, hclust, matrix.

Install

npm i klar-charts

import 'klar-charts/styles.css'
import { ThemeScope, ClusteredHeatmap } from 'klar-charts'

# or copy the source:
npx shadcn@latest add https://klar.run/r/sci-clustered-heatmap.json

Usage

<ClusteredHeatmap
  matrix={heatMatrix}
  rowLabels={heatGenes}
  colLabels={heatSamples.map((s) => s.id)}
  colAnnotations={heatAnnotations}
  linkage={linkage}
  height={560}
  scale="row"
  valueLabel="Row z-score"
  formatValue={(v) => `${v.toFixed(2)} log₂ CPM`}
/>

Related clustered heatmap charts