【问题标题】:Bqplot in jupyter lab returns a string instead of an (interactive) imagejupyter lab 中的 Bqplot 返回字符串而不是(交互式)图像
【发布时间】:2020-01-02 22:53:18
【问题描述】:

今天我第一次尝试安装模块 bqplot 并使用 jupyter lab。

但是,当使用他们网站上显示的基本示例时,我无法获得所需的输出。

我尝试执行的代码如下:

import numpy as np
from bqplot import pyplot as plt

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…

而在普通的 jupyter notebook 中,输出显示示例图像。

到目前为止,我不知道出了什么问题,如果有任何帮助,我将不胜感激!

谢谢。

【问题讨论】:

    标签: python-3.x jupyter-notebook jupyter-lab bqplot


    【解决方案1】:

    我遇到了同样的问题,并通过安装 bqplot labextension 和 @jupyter-widgets/jupyterlab-manager 扩展解决了它:

    jupyter labextension install @jupyter-widgets/jupyterlab-manager
    jupyter labextension install bqplot
    

    重新启动 jupyter lab 后,显示小部件。

    我猜误解在于bqplot的installation instructions:它只提到这些步骤为“实验性JupyterLab扩展”,但在Jupter Lab中启用bqplot的安装步骤却忽略了它们。

    【讨论】:

    • 完美。非常感谢!
    猜你喜欢
    • 2021-08-01
    • 2019-03-06
    • 2020-03-20
    • 2019-11-24
    • 2019-07-22
    • 2017-09-27
    • 1970-01-01
    • 2020-01-13
    • 2020-10-15
    相关资源
    最近更新 更多