Vega-Lite Auto-Binned Histogram

A histogram with completely automatic binning — Vega-Lite's `bin: true` on the x-encoding picks a sensible bin width and count for you (the algorithm targets ~10 bins by default), counts the rows per bin via the `aggregate: 'count'` shorthand on the y-encoding, and draws the bars

Template details

  • chart
  • histogram
  • distribution
  • binning
  • vega
  • vega-lite

When to use this template

This visualization makes the underlying distribution of a single numerical variable immediately obvious. An analyst reaches for it to quickly grasp the shape, spread, central tendency, and potential outliers within a dataset, revealing patterns like skewness or multiple modes without needing to inspect individual data points.

  • Single quantitative variable (continuous or ordinal)
  • Datasets with hundreds or thousands of observations for meaningful binning
  • Understanding the frequency of values within specific ranges
  • Identifying the most common values or value ranges
  • Detecting skewness, kurtosis, or multiple peaks in data
  • Data where individual value precision is less critical than overall distribution

Browse all Koan templates