2

我正在尝试使用散景创建一个 webapp。大多数情况下,它将由降价文本和一些数字组成。现在我被卡住了,要并排显示两个散景图形。在笔记本中,一切运行顺利,但在可视化中,我看到了类似的错误

Javascript Error: Error rendering Bokeh model: could not find #5db0eeb2-830f-4e00-b6fe-552a45536513 HTML tag

现在,如果我在经典的 jupyter notebook 中尝试(在 jupyter-lab Help->Launch Classic Notebook中),那么它可以很好地呈现。但是,当它从 github 提供时,我再次遇到 javascript 错误。

jupyterlab 中的一个 MWE 但在voilà中不工作是:

import numpy as np
import ipywidgets as widgets
import bokeh.plotting
from bokeh.io import output_notebook, show
from bokeh.models import ColumnDataSource, Line

output_notebook()

t = np.arange(10)
signal = np.arange(10)

f_1 = bokeh.plotting.figure(plot_width=400, plot_height=300, toolbar_location=None)
data_source_1 = ColumnDataSource(data=dict(t=t, signal=signal))
f_1.line(x='t', y='signal', source=data_source_1)

out_1 = widgets.Output()
with out_1:
    show(f_1)

f_2 = bokeh.plotting.figure(plot_width=400, plot_height=300, toolbar_location=None)
data_source_2 = ColumnDataSource(data=dict(t=t, signal=2*signal))
f_2.line(x='t', y='signal', source=data_source_2)

out_2 = widgets.Output()
with out_2:
    show(f_2)

widgets.HBox([out_1, out_2])

这是模拟调制迷你讲座的一部分:经典笔记本版本工作正常,但是当我尝试使用voilà-served版本时(单击Voilà那里的按钮或只是转到另一个链接)我遇到了同样的问题。

有什么线索吗?

4

0 回答 0