Matplotlib无法给我想要的可视化效果。
我喜欢Bokeh的交互功能,我想知道是否有人能够在Google Colab中运行它?
我安装了库(从笔记本本身安装),并显示安装成功。
!pip install bokeh
但是当我使用它时,它没有显示任何东西(甚至没有错误)。只有空白输出。当我检查Chrome的Javascript控制台时,我看到以下信息
Bokeh: 错误:无法运行BokehJS代码,因为缺少BokehJS库
Matplotlib无法给我想要的可视化效果。
我喜欢Bokeh的交互功能,我想知道是否有人能够在Google Colab中运行它?
我安装了库(从笔记本本身安装),并显示安装成功。
!pip install bokeh
但是当我使用它时,它没有显示任何东西(甚至没有错误)。只有空白输出。当我检查Chrome的Javascript控制台时,我看到以下信息
Bokeh: 错误:无法运行BokehJS代码,因为缺少BokehJS库
在图表示例笔记本中有一个Bokeh示例。
我怀疑你需要添加的重要部分是:
from bokeh.io import output_notebook
output_notebook()
最重要的是,output_notebook()
必须在同一个单元格内调用。
!pip install kora
from kora.bokeh import figure
p = figure(100, 200) # h, w
p.line([1, 2, 3, 4], [6, 7, 2, 4])
p # display itself, don't need show()
from kora import bokeh
,它可以像import bokeh
一样工作。或者你也可以同时使用它们。我的做法只是创建_repr_html_()
以帮助显示Figure对象。对于版本在2.x以上的bokeh,想要在Google Colab中显示bokeh图形,请尝试以下操作:
尝试
# Our main plotting package (must have explicit import of submodules)
import bokeh.io
import bokeh.plotting
# Enable viewing Bokeh plots in the notebook
bokeh.io.output_notebook()