Why are my Altair Data Visualizations not showing up in Github?

Viewed 165
1 Answers

Github's notebook viewer does not execute any embedded Javascript code, presumably for security reasons. Altair charts are rendered via javascript, so they do not appear in Github notebook views.

One way to address this is to embed a static PNG version of the chart in the notebook; this cannot be done without a notebook frontend extension. PNG embedding is done automatically if you render charts using Jupyter's frontend extensions: use alt.renderers.enable('jupyterlab') if using JupyterLab, or alt.renderers.enable('notebook') if using Jupyter Notebook. Note that both these approaches require correctly-configured Jupyter frontend extensions to be installed; see https://altair-viz.github.io/user_guide/display_frontends.html for details.

Related