Holoviews / Bokeh区域图将Hovertool添加到区域图

时间:2018-10-23 17:39:32

标签: python bokeh holoviews

我想在我的holoviews区域图中添加一个悬停工具,以便用户可以将鼠标悬停在x / y坐标上(x和y谨慎),并且悬停工具将通过以下方法捕捉到最近的x / y坐标类别。我已经选择将工具设置为悬停,但是除了交叉悬停外,我没有看到任何其他信息。我可以使用下面的本教程代码来复制该功能吗?

这也是教程代码的链接:http://holoviews.org/gallery/demos/matplotlib/area_chart.html

%%output size=200
%%opts Area  [height=200 width=400 tools=['hover'] xrotation=90] 
%%opts Overlay [width=600 legend_position='top_left' tools=['hover']] 

# create some example data
python=np.array([2, 3, 7, 5, 26, 221, 44, 233, 254, 265, 266, 267, 120, 111])
pypy=np.array([12, 33, 47, 15, 126, 121, 144, 233, 254, 225, 226, 267, 110, 130])
jython=np.array([22, 43, 10, 25, 26, 101, 114, 203, 194, 215, 201, 227, 139, 160])

dims = dict(kdims='time', vdims='memory')
python = hv.Area(python, label='python', **dims)
pypy   = hv.Area(pypy,   label='pypy',   **dims)
jython = hv.Area(jython, label='jython', **dims)

overlay = (python * pypy * jython).options('Area', fill_alpha=0.5)
overlay.relabel("Area Chart") + hv.Area.stack(overlay).relabel("Stacked Area Chart")

1 个答案:

答案 0 :(得分:0)

您可以显式导入

var value = Mathf.Lerp(-10, 10, inputValue); transform.position += Vector3.forward * value;

定义你的身材

from bokeh.models import HoverTool

from bokeh.plotting import figure

并将Hovertool添加到图中

fig = figure(some settings)

ht = HoverTool(show_arrow=False, tooltips=[if any], ..some settings)