Python Bokeh Hovertools根本没有显示悬停
我正试图从以下数据框绘制坐标Python Bokeh Hovertools根本没有显示悬停,python,pandas,bokeh,geopandas,Python,Pandas,Bokeh,Geopandas,我正试图从以下数据框绘制坐标gvri\u 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.12
gvri\u 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)
它很好地输出了预期的绘图,只是根本没有显示悬停。就像工具没有添加到绘图中一样
是我做错了什么,还是有人知道如何解决这个问题
谢谢 在执行p=figure(…)
之前,调用p.add_tools(悬停)
。看起来您只提供了部分代码,而悬停工具最终被添加到其他绘图中
为避免此类错误,请勿重复使用变量-这样做不会节省任何资源,但会增加出错的概率。谢谢!我完全忽略了这一点。解决了我的问题