我正在使用Jupyter笔记本上的Jupyterlab。在笔记本中,我经常使用:
import matplotlib.pyplot as plt
%matplotlib notebook
plt.figure()
x = [1,2,3]
y = [4,5,6]
plt.plot(x,y)
用于交互式绘图。现在给了我(在朱庇特实验室):
JavaScript output is disabled in JupyterLab
我也试过这个魔术(安装了jupyter-matplotlib):
%matplotlib ipympl
但这又回来了:
FigureCanvasNbAgg()
内联绘图:
%matplotlib inline
工作很好,但我想要互动的情节。
根据Georgy's suggestion,这是由于没有安装Node.js造成的。
完成步骤
nodejs
,例如conda install nodejs
。ipympl
,例如pip install ipympl
。pip install --upgrade jupyterlab
.]export JUPYTERLAB_DIR="$HOME/.local/share/jupyter/lab"
。]安装扩展:
启用小部件:
jupyter nbextension enable --py widgetsnbextension
。%matplotlib widget
装饰。不建议这样做,但要盲目地让小部件扩展在Anaconda中工作,可以在终端窗口中运行以下命令:
要启用jupyter matplotlib后端,请使用matplotlib jupyter魔术:
这里有更多信息jupyter-matplotlib on GitHub
相关问题 更多 >
编程相关推荐