我有一个简单的X-Y数据点图表。我希望我的Bokeh图显示每个数据点的整数值当我将鼠标悬停在其上时。我已经接近得到我想要的结果,但是当我将鼠标悬停在数据点上时,它显示了一个浮点数,然后更高一些,它使用科学计数法。有没有办法让悬停工具仅返回X和Y的整数值,而不使用科学计数法?
以下是一些示例代码:
from bokeh.plotting import *
from bokeh.models import HoverTool
x = range(1,101)
y = [i*i for i in x]
TOOLS = "pan,wheel_zoom,box_zoom,reset,save,box_select, hover"
p = figure(x_axis_label = "Days",
y_axis_label = "Return",
tools=TOOLS)
p.circle(x, y)
#adjust what information you get when you hover over it
hover = p.select(dict(type=HoverTool))
hover.tooltips = [
("Days", "$x"),
("Return", "$y"),
]
show(VBox(p))