我无法弄清楚我的 jupyter 笔记本中发生了什么。Vincent 和 Bokeh 工作正常,但在试用 Altair 时,我一定遗漏了一些东西,但我没有出错,在线文档也没有提到我的问题。
这就是我输入的内容(来自文档页面https://altair-viz.github.io/gallery/bar_aggregate.html)
from altair import *
Chart('http://vega.github.io/vega-lite/data/population.json',
description='A bar chart showing the US population distribution of age groups in 2000.',
).mark_bar().encode(
x=X('sum(people):Q',
axis=Axis(
title='population',
),
),
y=Y('age:O',
scale=Scale(
bandSize=17.0,
),
),
).transform_data(
filter='datum.year == 2000',
)
代码在我的 Jupyter 笔记本中执行,没有错误,但也没有图表。我确实安装了 vega,所以这不是问题。它不特定于该图,其他示例具有相同的行为。我不知道如何解决这个问题!