Contribute Media
A thank you to everyone who makes this possible: Read More

Altair Declarative, Statistical Visualization for Python

Description

PyData SF 2016

Altair is a declarative statistical visualization library for Python. Altair provides a user-centric Python API on top of the declarative visualization stack of Vega-Lite, Vega and D3.js. A wide range of statistical visualizations can be created with only a few carefully design abstractions. Altair provides a Python API for building statistical visualizations in a declarative manner. By statistical visualization we mean:

  • The data source is a DataFrame that consists of columns of different data types (quantitative, ordinal, nominal and date/time).
  • The DataFrame is in a tidy format where the rows correspond to samples and the columns correspond the observed variables.
  • The data is mapped to the visual properties (position, color, size, shape, faceting, etc.) using the group-by operation of Pandas and SQL.

The Altair API contains no actual visualization rendering code but instead emits JSON data structures following the Vega-Lite specification. For convenience, Altair can optionally use ipyvega to display client-side renderings seamlessly in the Jupyter notebook. Altair has the following features:

  • Carefully-designed, declarative Python API based on traitlets.
  • Auto-generated internal Python API that guarantees visualizations are type-checked and in full conformance with the Vega-Lite specification.
  • Auto-generate Altair Python code from a Vega-Lite JSON spec.
  • Display visualizations in the live Jupyter Notebook, on GitHub and nbviewer.
  • Export visualizations to PNG images, stand-alone HTML pages and the Online Vega-Lite Editor.
  • Serialize visualizations as JSON files.
  • Explore Altair with 40 example datasets and over 70 examples.

Altair is developed by Brian Granger and Jake Vanderplas in close collaboration with the UW Interactive Data Lab.

Details

Improve this page