【问题标题】:Holoviews/Bokeh Area Plot Add Hovertool to Area PlotHoloviews/Bokeh 区域图将 Hovertool 添加到区域图
【发布时间】:2018-10-24 04:21:06
【问题描述】:

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

【问题讨论】:

    标签: python bokeh holoviews


    【解决方案1】:

    您可以显式导入

    from bokeh.models import HoverTool

    定义你的身材

    from bokeh.plotting import figure

    fig = figure(some settings)

    并将 Hovertool 添加到图形

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

    fig.add_tools(ht)

    【讨论】:

    • 似乎不太适合 Holoviews。如果你可以让它与上面的代码一起工作,你能写出你的解决方案吗?
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-04-05
    • 2012-07-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多