Vega-Lite Rect Heatmap

A rectangular heatmap encoding a numeric variable as cell colour across two categorical axes — the canonical 'matrix view' chart. Vega-Lite's `rect` mark with `x: nominal`, `y: nominal`, and a `color: quantitative` channel produces a continuous-gradient cell grid automatically; l

Template details

  • chart
  • heatmap
  • matrix
  • vega
  • vega-lite

When to use this template

This visualization excels at revealing patterns, concentrations, and outliers in a quantitative measure when observed across two distinct categorical dimensions. Analysts use it to quickly identify high- or low-value cells, spot trends along rows or columns, and understand the overall distribution of a metric within a grid structure. It's ideal for comparing a metric's value across all pairwise combinations of two categories.

  • Data with exactly two categorical dimensions.
  • One continuous quantitative measure.
  • Categorical dimensions with medium to high cardinality (e.g., 5-50 unique values each).
  • When comparing a metric's value across all pairwise combinations of two categories.
  • Ideal for time-series data where categories represent time units (e.g., day of week, hour of day).
  • When relative differences and absolute values of the metric are equally important.

Browse all Koan templates