【问题标题】:Bokeh: Data Table and Tap Tool not working together散景:数据表和点击工具不能一起工作
【发布时间】:2018-11-08 19:54:04
【问题描述】:

我在使用bokeh的TapTool和DataTable时遇到了以下问题:

只要单击一个点(使用 TapTool),DataTable 上的选择就不会再在图中显示。

这是 Jupyter Notebook 的最小示例:

from bokeh.plotting import show, output_notebook, figure
from bokeh.models import ColumnDataSource, OpenURL, TapTool
from bokeh.layouts import widgetbox, column
from bokeh.models.widgets import DataTable, TableColumn

source = ColumnDataSource(dict(
            x=[1, 2, 3, 4, 5],
            y=[6, 7, 2, 4, 5],
            url=["http://www.stackoverflow.com"]*5))

p = figure(plot_width=400, 
           plot_height=400,
          tools="tap,reset",
          )

p.circle(source=source, 
         x="x", 
         y="y", 
         size=20, 
         color="navy", 
         alpha=0.5)


columns = [
    TableColumn(field="x", title="X-Value"),
    TableColumn(field="y", title="Y-Value"),
    TableColumn(field="url", title="URL")
]
data_table = DataTable(source=source, columns=columns,
                      width=400, height=400)


url = "@url"
taptool = p.select(type=TapTool)
taptool.callback = OpenURL(url=url)

output_notebook()
show(column(p, widgetbox(data_table)))

预期行为:DataTable 中的选择会在图中显示,就像单击一个点之前一样。

提前谢谢大家。

【问题讨论】:

    标签: python bokeh


    【解决方案1】:

    问题解决了。这是散景 0.13 中的一个问题 使用 anaconda 我无法更新到 1.0.1,所以我创建了一个新环境,其中散景可以是 1.0.1,问题不再存在。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-07-18
      • 2013-08-21
      • 2017-02-08
      • 1970-01-01
      • 2015-02-17
      • 1970-01-01
      • 1970-01-01
      • 2018-01-14
      相关资源
      最近更新 更多