Alberto
Alberto

Reputation: 341

Altair: Javascript error prevents chart display

I am starting to use Altair and at the moment I am just trying to replicate what is done here: https://altair-viz.github.io/gallery/filled_step_chart.html .

I have just tried to run that code on my Mac (OS 10.14.6) with python 3.6 (tried also with python3.8) in Jupyter in Mozilla Firefox 74.0.1 (64-bit) and I get this error as output:

Javascript error adding output!

TypeError: document.currentScript is null

See your browser Javascript console for more details.

This is what I see, also checking the Console's errors:

code and error in Jupyter

I have tried to trouble shoot following the instructions on the Altair's pages: https://altair-viz.github.io/user_guide/troubleshooting.html#chart-does-not-display-at-all, but I would need more guidance.

Thank you for your help in advance.


Update 15 April 2020:

After trying @jakevdp's workaround (https://altair-viz.github.io/user_guide/display_frontends.html#displaying-in-the-jupyter-notebook), adding the line

alt.renderers.enable('notebook')

I don't see anymore that error in Jupyter nor in the Console, however, the plot doesn't show up: no output despite no errors

Upvotes: 3

Views: 1877

Answers (1)

jakevdp
jakevdp

Reputation: 86533

This looks like a bug in Altair's HTML renderer; please report it at http://github.com/altair-viz/altair/issues.

As a workaround, you should be able to use the vega nbextension, as described here: https://altair-viz.github.io/user_guide/display_frontends.html#displaying-in-the-jupyter-notebook

Upvotes: 1

Related Questions