小编Ste*_*eve的帖子

在笔记本中获取散景的选择

我想在图上选择一些点(例如 frombox_selectlasso_select)并在 Jupyter notebook 中检索它们以进行进一步的数据探索。我怎样才能做到这一点?

例如,在下面的代码中,如何将选择从散景导出到笔记本?如果我需要 Bokeh 服务器,这也很好(我在文档中看到我可以添加与服务器的“双向通信”,但没有设法调整示例以实现我的目标)。

from random import random
from bokeh.io import output_notebook, show
from bokeh.plotting import figure
from bokeh.models.sources import ColumnDataSource

output_notebook()

x = [random() for x in range(1000)]
y = [random() for y in range(1000)]

s = ColumnDataSource(data=dict(x=x, y=y))
fig = figure(tools=['box_select', 'lasso_select', 'reset'])
fig.circle("x", "y", source=s, alpha=0.6)

show(fig)
# Select on the plot
# Get selection in a ColumnDataSource, or index list, or pandas object, or etc.?
Run Code Online (Sandbox Code Playgroud)

笔记 …

python bokeh jupyter-notebook

5
推荐指数
1
解决办法
598
查看次数

标签 统计

bokeh ×1

jupyter-notebook ×1

python ×1