python-3.x - jupyter lab 中的 Bqplot 返回字符串而不是(交互式)图像
问题描述
今天我一直在尝试安装模块 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 中,输出显示的是示例图像。
到目前为止,我不知道出了什么问题,希望能提供任何帮助!
谢谢。
解决方案
我遇到了同样的问题,并通过安装bqplot
labextension 和@jupyter-widgets/jupyterlab-manager
扩展来解决它:
jupyter labextension install @jupyter-widgets/jupyterlab-manager
jupyter labextension install bqplot
重新启动 jupyter lab 后,将显示小部件。
我猜误解在于 bqplot 的安装说明:它仅将这些步骤称为“实验性 JupyterLab 扩展”,但在 Jupter Lab 中启用 bqplot 的安装步骤却忽略了它们。
推荐阅读
- ios - 从领域缓存中请求所有数据并保持数据更新 - iOS App Architecture
- c# - Windows 服务无法访问 json 文件
- c# - 从视图到控制器的数据正在传递空值
- haskell - 双递归定义列表的双重无限列表
- excel - VBA代码自动将我的工作簿副本保存为只读
- html - div 内的元素淡入淡出效果。我如何实现这个脚本?
- reactjs - 如何从子组件更新父状态数组?
- c# - 使用系统 Windows 自动化发送 WM_COPYDATA 消息
- matlab - MATLAB 计时器在函数内部的作用与在命令窗口中的作用不同
- c# - 序列化和反序列化字典
Web API 中的 REST 服务之间