SPECIMEN  ·  § VII  ·  DATA  ·  VEGA-LITE PROJECT LAVOS · THE STACK

Grammatica picturarum simplicissima. grammar of graphics, simplified · vega-lite, washington 2017

vega-lite.

ONE  SPEC  ·  FIVE  FORMS  ·  ONE  DATASET

Charts as JSON. The same nine plates of Project Lavos — their word counts in llms-full.txt — plotted five ways. Each toggle changes one property of the spec; everything else stays the same. Watch what the change does.

i.

What you're seeing.

Every chart on the left is generated from the JSON on the right. The JSON is the complete description of the chart — there is no surrounding code to look at. Vega-Lite reads the spec, decides how to render it, and produces SVG.

The five toggles do not change the data. They change one spec property at a time:

  • mark — what shape represents each row. "bar""point".
  • encoding — what each chart axis or channel is bound to. Adding a color channel is one line of JSON.
  • encoding.x.sort — how rows are ordered on an axis. Sort ascending, descending, or by another field, by adding one property.
  • layer — composition. Two marks rendered on the same axes by listing them in a layer array. The grammar composes.

This is the point. In Vega-Lite, "what to draw" and "how to draw it" are the same JSON. Change the JSON, the chart changes. Read the JSON, you know the chart.

ii.

Lineage.

Leland Wilkinson, 1999. The Grammar of Graphics publishes the formal grammar — every statistical chart is a composition of: data, geometry, scale, statistics, coordinates, aesthetics. Wilkinson's grammar reframes "chart types" (bar, line, scatter) as products of underlying primitives.

Polaris / Tableau, 2003–2004. Wilkinson's grammar implemented as a query system that becomes Tableau. Drag a field onto an axis; the grammar produces the chart.

Hadley Wickham's ggplot2, 2007. The R implementation of the grammar, in code. aes(x=plate, y=words). Becomes the standard for statistical graphics in academic and industry R.

UW Interactive Data Lab, 2014. Vega is published — JSON-spec implementation of the grammar in the browser.

Vega-Lite, 2017. Same lab. Vega is too low-level for everyday use; Vega-Lite is its higher-level companion. Defaults are sensible. The JSON is small. Common chart types are short.

Today: Altair (Python wrapper) is the second-most-installed Python charting library after matplotlib. Vega-Lite ships in JupyterLab, Observable, Looker, IBM Cognos. The grammar that started in 1999 became infrastructure.

§

specimen notes.

This is Specimen 001 in a series mapping each entry of The Stack to a working demonstration. The Stack is the inventory; specimens are its rows, deepened. Plate IX (The Path Tracer) was the prototype — pulling three rows of Stage I and giving them a plate. Specimens do the same at smaller scale, one row at a time.

The form is not a plate. It is a single screen, a working demo, and an annotation. Plate X waits until enough specimens exist for a meta-argument across them.