Declarative Visualization in Python


Altair is a declarative statistical visualization library for Python, based on 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.

Note: Altair and the underlying Vega-Lite library are under active development, and the documentation here, although extensive, remains incomplete. We are currently (October 2017) working on support for Vega-Lite 2.0, and plan to significantly expand the documentation once that is released.


Here is an example of using the Altair API to quickly visualize a dataset:

import altair as alt

# load built-in dataset as a pandas DataFrame
cars = alt.load_dataset('cars')

# Uncomment for rendering in JupyterLab & nteract
# alt.enable_mime_rendering()


The key idea is that you are declaring links between data columns and visual encoding channels, such as the x-axis, y-axis, color, etc. The rest of the plot details are handled automatically. Building on this declarative plotting idea, a surprising number of useful plots and visualizations can be created and a relatively small grammar.

More examples are available in the Example Gallery, or you can work through one of the Tutorials. The full documentation listing is available below.

Bug Reports & Questions

Altair is BSD-licensed and the source is available on GitHub. If any questions or issues come up as you use Altair, please get in touch via Git Issues or our Google Group.

Indices and tables