Skip to content
Vega-Lite templates

Maths — Histogram of Exam Scores

A frequency distribution as a bar chart.

Template previewVega-Lite
Rendering…

Make it your own.

{
  "$schema": "https://vega.github.io/schema/vega-lite/v5.json",
  "description": "Distribution of exam scores",
  "data": {"values": [
    {"bin":"0-20","count":2},
    {"bin":"20-40","count":7},
    {"bin":"40-60","count":18},
    {"bin":"60-80","count":25},
    {"bin":"80-100","count":11}
  ]},
  "mark": "bar",
  "encoding": {
    "x": {"field":"bin","type":"ordinal","title":"Score range"},
    "y": {"field":"count","type":"quantitative","title":"Frequency"},
    "color": {"field":"bin","type":"nominal","legend":null}
  }
}