栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 面试经验 > 面试问答

散景图:仅对某些字形启用工具提示

面试问答 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

散景图:仅对某些字形启用工具提示

多亏了Google网上论坛中的此页面,我才知道如何做到这一点。
连结这里

编辑2015-10-20 :很遗憾,似乎Google网上论坛链接不再起作用。这是来自Sarah Bird @bokehplot的消息。

编辑2017年1月18日
:当前,这会将多个悬停工具图标添加到工具栏。这可能会引起问题。目前已经在GitHub上提交一个问题在这里。或者,在下面的答案中尝试@tterry的解决方案。

基本上,您需要(散景版本0.9.2):

  1. 创建图形时不要添加
    hover
    到您
    tools
    的图形中
  2. 分别创建字形
  3. 在您的图形上添加字形
  4. 为这组字形设置悬停工具
  5. 将悬停工具添加到您的图形中

例:

import bokeh.models as bkmimport bokeh.plotting as bkpsource = bkm.ColumnDataSource(data=your_frame)p = bkp.figure(tools='add the tools you want here, but no hover!')g1 = bkm.Cross(x='col1', y='col2')g1_r = p.add_glyph(source_or_glyph=source, glyph=g1)g1_hover = bkm.HoverTool(renderers=[g1_r],   tooltips=[('x', '@col1'), ('y', '@col2')])p.add_tools(g1_hover)# now repeat the above for the next sets of glyphs you want to add. # for those you don't want tooltips to show when hovering over, just don't # add hover tool for them!

另外,如果需要将图例添加到要添加的每个字形中,请尝试使用

bokeh.plotting_helpers._update_legend()
method。github来源例如:

_update_legend(plot=p, legend_name='data1', glyph_renderer=g1_r)


转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/645319.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号