Vega
Vega is a visualization grammar: a declarative domain-specific language for specifying interactive data visualizations as JSON documents. A Vega specification describes a chart or visualization in terms of its data sources, scales, axes, marks, and interactions, rather than as a sequence of drawing operations. A runtime, implemented in JavaScript and running in the browser, interprets the specification and renders the result, typically to SVG or HTML5 Canvas. The project is led by the University of Washington Interactive Data Lab and builds on the lineage of Leland Wilkinson’s Grammar of Graphics, which reframed statistical charts as the composition of small orthogonal components rather than fixed chart types.
The Vega project ships two grammars at different levels of abstraction. Vega itself is the lower-level grammar, exposing the full building blocks of the grammar of graphics: data transforms, scales, axes, legends, and a dataflow graph of signals. Vega-Lite is a higher-level grammar with a smaller vocabulary, optimized for common chart types and exploratory analysis. A Vega-Lite specification is compiled down to a Vega specification, which is then rendered. The two-tier design lets analysts work in the more constrained language most of the time and drop down to Vega only when they need finer control. It is an application of the rule of least power, where the weaker language is preferred whenever it can still do the job.
Interactivity in Vega is expressed through signals: named values that change in response to user input, data updates, or other signals. Signals form a reactive dataflow graph. When one signal changes, the runtime propagates the change to dependent signals, scales, and marks, and re-renders only the affected parts. This makes it possible to express selections, linked views, and dynamic queries entirely in the specification, without imperative event handlers. The model is directly inspired by dataflow and reactive programming, and it is what distinguishes Vega from more imperative visualization libraries such as D3.js, where interactivity is hand-written in code.
The ecosystem around Vega is broad. Vega-Embed is the standard library for embedding Vega and Vega-Lite visualizations in web pages. Altair is a Python library that exposes Vega-Lite as a declarative API and is widely used in the data science community. Voyager and Polestar are exploratory analysis tools built on top of Vega-Lite. The grammar is general enough to encode network and graph visualizations, complementing more specialized interchange formats such as GraphML that focus on serializing graph structure.
See also
References
- Wilkinson, Leland (2005). The Grammar of Graphics. Springer.
- Satyanarayan, Arvind; Wongsuphasawat, Kanit; Heer, Jeffrey (2016). Vega-Lite: A Grammar of Interactive Graphics. IEEE Transactions on Visualization and Computer Graphics.