To understand Altair we need to know what is it built on. The following hierarchy enables us to understand that -

Lets start with Vega.

What is Vega?

Vega is a visualization grammar, a declarative language for creating, saving, and sharing interactive visualization designs. With Vega, you can describe the visual appearance and interactive behavior of a visualization in a JSON format, and generate web-based views using Canvas or SVG.

Note: visualization grammar

Where does D3 fit in here?

To be clear, Vega is not intended as a “replacement” for D3. D3 is intentionally a lower-level library. During the early design of D3, we even referred to it as a “visualization kernel” rather than a “toolkit” or “framework”. In addition to custom design, D3 is intended as a supporting layer for higher-level visualization tools. Vega is one such tool, and Vega uses D3 heavily within its implementation.

Vega provides a higher-level visualization specification language on top of D3. By design, D3 will maintain an “expressivity advantage” and in some cases will be better suited for novel design ideas. On the other hand, we intend Vega to be convenient for a wide range of common yet customizable visualizations.

Now, that we know the top hierarchy, the rest is easy to follow -

Vega-Lite

Vega-Lite is a high-level grammar of interactive graphics. It provides a concise JSON syntax for rapidly generating visualizations to support analysis. Vega-Lite specifications can be compiled to Vega specifications.

Note: high-level visualization grammar

Vega-Lite is used by some big players -

  • Apple
  • Google
  • Microsoft
  • Tableau
  • Airbnb
  • JupyterLab
  • LA Times
  • CERN
  • Massachusetts Institute of Technology
  • University of Washington
  • Carnegie Mellon University
  • Berkeley

Altair

In short, Altair exposes a Python API for building statistical visualizations that follows Vega-Lite syntax.

Altair is a declarative statistical visualization library for Python, based on Vega and Vega-Lite. With Altair, you can spend more time understanding your data and its meaning.

Altair’s API is simple, friendly and consistent and built on top of the powerful Vega-Lite visualization grammar. This elegant simplicity produces beautiful and effective visualizations with a minimal amount of code.


I do not intend to teach you how to use Altair or Vega Lite. You can do that on your own using the following excellent resources -

  • Conference Talk by Jake VanderPlas