Sunday 10:15 AM–10:45 AM in C01

Altair: Declarative Visualizations in Python

Nipun Batra

Audience level:


Matploltib has existed for more than a decade. In the recent past many Python visualisation libraries have been released. However, often the focus is on "how" to plot, rather than "what" to plot. In this talk, I'll introduce Altair, a declarative library that focuses on the "what" to plot. This talk will an example-driven talk.

Perquisites: Some familiarity with Pandas and Matplotlib.



Matplotlib has existed for more than a decade. Various other Python visualisation libraries have been released in the recent past. However, with most of these libraries.have a heavy focus on "how" to plot. In contrast, Altair is a declarative visualisation library that focuses on "what" we need to plot.


At this stage, I'll introduce a few example plots made in Matplotlib and show how the code focuses on "how" in comparison to "what" needs to be plotted.

While showing these examples, I'll show how quickly these examples grow in complexity

Introduction to Altair


Before diving deep into concepts behind Altair, I'll show how the examples I wrote earlier can be written trivially in Altair.

Origin of Altair and relationship with D3/Vega/Vega-lite

I'll explain how Altair leverages Vega-lite specification, which is a subset of Vega specification, which is based on D3.

Key API features

I'll pick up from the examples presented earlier and introduce the key concepts and the API of Altair. This will include:

Layering in Altair

With the help of examples, I'll show how easy it is to add layers to charts.

Is Altair perfect?

In this part of the talk, I'll present my views as a researcher on the suitability of Altair for production-ready plotting for web graphics/LaTeX figures.

With permission, I'd be borrowing some ideas and suggestions from Jake Vanderplas, and Brian Granger who are the authors of Altair.

Subscribe to Receive PyData Updates



Get Now