I am using Altair Visualization library for plotting charts in a kaggle kernel. When I run cell by cell, the charts show up. But when I commit the notebook and see the result, the charts are not shown.
I checked the altair version using the alt.version command.
I am using the latest version of altair as per the above result. I even tried adding 'vega' package from settings and committing. Even then, the altair charts were not shown. Not sure what's going wrong.
For Altair 2.2 you can use the notebook
renderer to make altair charts render:
import altair as alt
alt.renderers.enable('notebook')
Note, however, that these charts will only display when the kernel is live, not when view of the kernel statically (e.g. when sharing a kernel).
In the master branch of Altair, we have just merged a kaggle renderer, and once this makes it into a release (Altair 2.3 or newer) you will be able to use
alt.renderers.enable('kaggle')
and then plots will show in both live and static views of kernels. I have an example of this in action here: https://www.kaggle.com/jakevdp/altair-kaggle-renderer-test