This is a collection of demo notebooks for plotting in Python with Altair/Vega-Lite.
To get started with Altair, follow the instructions in the Altair documentation.
If you are using Conda for managing your Python packages and environments, the following one-liner will set up a new environment altair for you and install the required packages:
conda create -n altair -c conda-forge python=3.7 altair vega_datasets jupyterlabThis uses JupyterLab. After installation you can launch a new session with
jupyter labIf you want to programatically save svg or png versions of your graphs, you'll need to also install
the selenium Python package and the chromedriver executable - see the Altair docs or ask your favourite search engine for help.
Please note: Interactive graphs work neither in the GitHub notebook preview nor in nbviewer.
To play with the interactive graphs you'll have to clone the notebook and open it in your local JupyterLab environment.
For some graphs there's also a html version saved in the output folder.
(Or does anybody know how to view notebooks with interactive graphs in a zero-installation way like nbviewer? Let me know!)
- quickstart_example.ipynb: Example from the quickstart section of the Altair docs (to check installation worked)
- display_examples.ipynb: Different ways of showing or saving charts (show in nbviewer)
- interactive_examples.ipynb: Some interactive examples copied from the Altair docs (show in nbviewer)
- talk_plots.ipynb: Example plots used in talk slides (show in nbviewer)
- live_demo.ipynb: Cheat sheet and results for live demo (show in nbviewer)
- Altair docs: https://altair-viz.github.io/index.html
- Altair example gallery - the best place to start! https://altair-viz.github.io/gallery/index.html#
- Vega-Lite docs: https://vega.github.io/vega-lite/
- Vega-Embed docs: https://github.com/vega/vega-embed
- Wickham paper, base for ggplot2: http://vita.had.co.nz/papers/layered-grammar.pdf
- Nice introductory slides to ggplot2: https://pkg.garrickadenbuie.com/gentle-ggplot2/#1
- A Dramatic Tour through Python’s Data Visualization Landscape (including ggplot and Altair): https://dsaber.com/2017/10/02/a-dramatic-tour-through-pythons-data-visualization-landscape-including-ggplot-and-altair/
- Jake VanderPlas - How to Think about Data Visualization - PyCon 2019: https://www.youtube.com/watch?v=vTingdk_pVM