让 Altair 与 Jupyter Notebook 一起工作
Getting Altair to work with Jupyter Notebook
为了让 Altair 与 Jupyter Notebook 一起工作,我使用
安装了它
conda install -c conda-forge altair vega_datasets notebook vega
但是当我尝试做一个示例图时
import altair as alt
from vega_datasets import data
# for the notebook only (not for JupyterLab) run this command once per session
alt.renderers.enable('notebook')
iris = data.iris()
alt.Chart(iris).mark_point().encode(
x='petalLength',
y='petalWidth',
color='species'
)
正如他们 quick start guide 所见,我得到
ValueError:
To use the 'notebook' renderer, you must install the vega package
and the associated Jupyter extension.
See https://altair-viz.github.io/getting_started/installation.html
for more information.
尽管我已经使用 Conda 安装了 vega。不过,我 可以 制作织女星示例图。我无法启用 Jupyter 扩展,因为 Jupyter 说它不兼容。
感谢任何帮助。
对于当前版本的 altair(版本 2.2),使用
conda install -c conda-forge vega=1.3
或
pip install vega==1.3
然后重启笔记本。
本周 vega
python 扩展被错误地更新为仅支持 vega-lite 3.0,该版本尚未发布,因此还不受 Altair 支持。
有关初始错误报告,请参阅 https://github.com/altair-viz/altair/issues/1114。
为了让 Altair 与 Jupyter Notebook 一起工作,我使用
安装了它conda install -c conda-forge altair vega_datasets notebook vega
但是当我尝试做一个示例图时
import altair as alt
from vega_datasets import data
# for the notebook only (not for JupyterLab) run this command once per session
alt.renderers.enable('notebook')
iris = data.iris()
alt.Chart(iris).mark_point().encode(
x='petalLength',
y='petalWidth',
color='species'
)
正如他们 quick start guide 所见,我得到
ValueError:
To use the 'notebook' renderer, you must install the vega package
and the associated Jupyter extension.
See https://altair-viz.github.io/getting_started/installation.html
for more information.
尽管我已经使用 Conda 安装了 vega。不过,我 可以 制作织女星示例图。我无法启用 Jupyter 扩展,因为 Jupyter 说它不兼容。
感谢任何帮助。
对于当前版本的 altair(版本 2.2),使用
conda install -c conda-forge vega=1.3
或
pip install vega==1.3
然后重启笔记本。
本周 vega
python 扩展被错误地更新为仅支持 vega-lite 3.0,该版本尚未发布,因此还不受 Altair 支持。
有关初始错误报告,请参阅 https://github.com/altair-viz/altair/issues/1114。