如果我在jupyter notebook
上运行此代码
from bqplot import pyplot as plt
import numpy as np
plt.figure(1, title='Line Chart')
np.random.seed(0)
n = 200
x = np.linspace(0.0, 10.0, n)
y = np.cumsum(np.random.randn(n))
plt.plot(x, y)
plt.show()
显示情节,但是如果我在Jupyter实验室运行相同的代码,则会得到
VBox(children=(Figure(axes=[Axis(scale=LinearScale()), Axis(orientation='vertical', scale=LinearScale())], fig…
我该如何解决?
答案 0 :(得分:1)
$ pip install bqplot
$ jupyter labextension install @jupyter-widgets/jupyterlab-manager
$ jupyter labextension install bqplot
import bqplot
然后重新启动jupyter实验室。你准备好了!
答案 1 :(得分:0)
您好,只需在单元格中键入此代码,然后运行它,它就可以正常工作!
%matplotlib inline