Skip to content

Vega-Lite

Vega-Lite is a language for describing charts in JSON: you name the data, the mark and which column goes on each axis, and a renderer draws it. Altair writes Vega-Lite for you.

A small spec:

json
{
  "mark": "point",
  "encoding": {
    "x": {"field": "gdp_per_capita", "type": "quantitative"},
    "y": {"field": "life_expectancy", "type": "quantitative"}
  }
}

The chart is described rather than drawn step by step, so the same spec renders in a notebook, on a web page or on a course page. chart.to_json() shows the Vega-Lite behind any Altair chart.

Learn more

  • JSON

    JSON is a text format for structured data: labels and values inside curly braces, lists inside square brackets. Programs use it to pass data to each other.

  • Altair

    Altair (Vega-Altair) is a Python package for making charts by describing them: you say which column goes on each axis, color or size, and it writes the Vega-Lite that draws the chart.

All terms