0
$\begingroup$

Wondering if anyone can help me understand why python altair chart is not printing...

I’m only seeing this when I run the code:

enter image description here

It literally isn’t outputting anything.

This is what my chart looks like converted to_dict; recommended for troubleshooting to ensure you have data.

enter image description here

Any ideas about why it’s not displaying a graph/chart/etc, and only printing a blank line?

Adding the head of the csv in pandas form.

enter image description here

$\endgroup$
4
  • $\begingroup$ It may be helpful if you post more of your code and/or a sample of your data. Have you already added %matplotlib inline at the top of your notebook? This enables matplotlib figures to be shown inline. $\endgroup$ – zachdj Aug 20 '19 at 13:46
  • 1
    $\begingroup$ Thanks for the suggestion @zachdj. I just added "%matplotlib inline" at the top and it still didn't work. I did think that was necessary since I'm trying to display a Altair chart and not a matplotlib graph. $\endgroup$ – standarduser Aug 20 '19 at 17:59
  • $\begingroup$ I've never used Altair before, and mistakenly assumed that it was using matplotlib as a backend (similar to seaborn). It looks like you've already enabled the notebook renderer. Do you have vega installed in the environment running your notebook? $\endgroup$ – zachdj Aug 20 '19 at 18:57
  • $\begingroup$ No worries. I think that might be it. I have it installed on my system, but apparently not enabled for the notebook. Any ideas about the following error? When I run this command: sudo jupyter nbextension enable --sys-prefix vega I keep getting the following error : OSError: [Errno 1] Operation not permitted: '/System/Library/Frameworks/Python.framework/Versions/2.7/etc' $\endgroup$ – standarduser Aug 20 '19 at 20:11
1
$\begingroup$

The issue was enabling the vega module/extension in the notebook. Installing it is only half the battle, then you must enable it. :)

sudo jupyter-nbextension enable vega --py --user

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.