Exporting interactive graphs with Altair

This is a demonstration notebook on how to export ipython notebooks to static HTML files while preserving the interactive nature of Altair charts.

This export mechanism also allows you to hide code cells, while preserving the output. For this to work you will need to add the tag hidecode to the cell you don't want to render.

With both of these elements it is easy to prepare a professional looking report from within Jupyter Lab, with minimal tweaks. Preserving graph interactivity on the static HTML file is also a great way to easily distribute our results

There should be a code cell above, but I've hid it.
Remember you can add the tag 'hidecode' to any cell you don't want to render.
This is especially useful if you're mostly interested in creating a presentation-worthy report straight from your notebook.
In [2]:
import altair as alt
from vega_datasets import data

source = data.cars()

    tooltip=['Name', 'Origin', 'Horsepower', 'Miles_per_Gallon']
    title="Hey! I'm interactive! Hover over datapoints, zoom and move around!"