Altair的图形未显示 [英] graphs from Altair are not displaying

查看:420
本文介绍了Altair的图形未显示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Ubuntu x64上,我刚刚安装了Anaconda 3.

On Ubuntu x64, I just freshly installed Anaconda 3.

然后我按照这些说明通过conda安装了altair.然后运行示例代码:

I then installed altair via conda per these directions. Then I run the example code:

from altair import *
population = load_dataset('population')

Chart(population).mark_bar().encode(
    x='sum(people)',
).transform_data(filter="datum.year==2000")

代码运行,但是什么也没有发生.我希望网页可能会在浏览器中打开,就像bokeh一样.为了安全起见,我还在后台运行jupyter notebook并重新运行了代码-没什么区别.

The code runs, but nothing happens. I expected a page would open in the browser perhaps, like bokeh does. To be safe, I also ran jupyter notebook in the background and re-running the code - no difference.

如果您需要有关我的环境的更多信息,请告诉我.

Please let me know if there's more information you need about my environment.

推荐答案

感谢@cel,我发现该代码无法在Anaconda的iPython控制台中运行-需要从Jupyter笔记本中运行.

Thanks to @cel, I found out the code cannot be run in the iPython console from Anaconda - it needs to be run from a Jupyter notebook.

您必须在终端中运行jupyter notebook,然后创建一个新的iPython Notebook.创建笔记本后,您可以从笔记本中交互式地运行代码.

You have to run jupyter notebook in the terminal, then create a new iPython Notebook. Once the notebook is created, you can run your code interactively from the notebook.

这篇关于Altair的图形未显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆