Bokeh Hovertools根本不显示悬停

问题描述 投票:0回答:1

我正在尝试从以下数据框gvri_df绘制坐标:

   id   ob       x                y
0   1   1   121877.864934   487888.548119
1   2   2   121772.572154   487952.500882
2   3   3   121824.001607   487927.953991
3   4   4   121887.380073   486978.455422
4   5   5   117820.122667   487964.987875

使用以下代码

source = ColumnDataSource(gvri_df)

hover = HoverTool()
hover.tooltips=[('VRI', '@id'),
                ('Kruispunt', '@ob')]

p.add_tools(hover)

# Plotting
p = figure(title="VRI")
p.circle('x', 'y', source=source, color='red', size=5)


show(p)

它很好地输出了预期的情节,只是它根本不显示悬停。好像该工具没有添加到绘图中。

plot

我做错什么了吗,还是有人知道如何解决这个问题?

谢谢!

python pandas bokeh geopandas
1个回答
1
投票

您在执行p.add_tools(hover)之前先呼叫p = figure(...)。似乎您只提供了部分代码,并且悬停工具最终被添加到了其他绘图中。

© www.soinside.com 2019 - 2024. All rights reserved.