Vega-Lite Error Band over Line

A line chart with a shaded confidence band — drawn as a layered `area` mark behind a `line` mark, both sharing the same x and a y2 encoding for the upper bound. Vega-Lite's grammar lets you compute the band on the fly (e.g. mean ± 1.96 × stderr) using `transform: aggregate` and `

Template details

  • chart
  • line
  • error-band
  • uncertainty
  • vega
  • vega-lite

When to use this template

This visualization clearly communicates a central trend while simultaneously showing its inherent uncertainty or variability. Analysts use it to understand not just what is happening, but also the confidence or range around that observation, making it ideal for evaluating predictions, assessing stability, or comparing groups with statistical rigor.

  • Time-series data with a primary trend and an associated uncertainty range.
  • Datasets where a central measure (e.g., mean) is accompanied by lower and upper bounds.
  • Quantitative data where variability or confidence intervals are crucial for interpretation.
  • Forecasting models outputting point estimates and prediction intervals.
  • Experimental results showing average effects with standard errors or confidence limits.
  • Sequential measurements where sensor noise or calibration error needs to be visualized.

Browse all Koan templates