全息视图/散景区域图 将悬停工具添加到区域图



我想在我的全息视图区域图中添加一个悬停工具,以便用户可以将鼠标悬停在 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")

您可以显式导入

from bokeh.models import HoverTool

定义你的身材

from bokeh.plotting import figure

fig = figure(some settings)

并将悬停工具添加到图中

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

fig.add_tools(ht)

最新更新