Bokeh Jupyter 笔记本


在 Jupyter notebook 中显示Bokeh 图与上面的非常相似。你需要做的唯一更改是从 bokeh.plotting 模块导入 output_notebook 而不是 output_file。

from bokeh.plotting import figure, output_notebook, show

调用 output_notebook() 函数将 Jupyter notebook 的输出单元格设置为 show() 函数的目的地,如下所示:

output_notebook()
show(p)

在笔记本单元格中输入代码并运行它。正弦波将显示在笔记本内。