散景,如何添加“?”在配置绘图工具中
Bokeh, how do I add the "?" in the configuring plot tool
我在 bokeh 文档中找不到有关 helptool 的信息。所有其他工具都有解释,但这个没有。我说的是工具栏中的这些工具:
http://docs.bokeh.org/en/latest/docs/user_guide/tools.html
我可以毫无问题地选择我想使用的大部分绘图工具。我想包括帮助工具,它在散景徽标之前清晰可见,但是我找不到任何直接引用它。
我刚刚测试了它(!),如果你想要帮助工具,它有一个“?” sybmol,如果您没有指定与绘图一起显示的工具,它只会默认包含在内。好的,我会接受这个,但我不会有“?”如果我选择工具。
我想我理解你的问题。您是说默认情况下工具面板将包含帮助工具。当您从头开始指定所有工具时,默认情况下不包括帮助工具。
如果您在未指定任何工具的情况下生成图,请列出图上的所有工具:
p.tools
>>>>
[PanTool(id='450f2e26-e0e5-4d90-89c4-44d20f2f688b', ...),
WheelZoomTool(id='84011ce1-4f73-4abb-abd1-26a830b70635', ...),
BoxZoomTool(id='adbfb29a-aa7d-4883-8f8f-d12b7c5af139', ...),
SaveTool(id='ff6ba8bb-c487-418d-82e5-28ff0402e2d6', ...),
ResetTool(id='dfac2559-da4c-4902-829d-f795ee0bfd56', ...),
HelpTool(id='1141330c-e9ff-4e5b-a737-3517c24f263e', ...)]
所以你可以看到有一个帮助工具。它也在文件中
http://docs.bokeh.org/en/latest/docs/reference/models/tools.html#bokeh.models.tools.HelpTool
因此您可以通过两种方式导入此工具并将其添加到绘图中:
from bokeh.plotting import figure, output_file, show
from bokeh.models import HelpTool
output_file("toolbar.html")
# create a new plot with the toolbar below
p = figure(plot_width=400, plot_height=400,
title=None, toolbar_location="below", tools="pan,wheel_zoom,box_zoom,reset")
p.add_tools(HelpTool())
p.circle([1, 2, 3, 4, 5], [2, 5, 8, 2, 7], size=10)
show(p)
或者更简单地说:
from bokeh.plotting import figure, output_file, show
output_file("toolbar.html")
# create a new plot with the toolbar below
p = figure(plot_width=400, plot_height=400,
title=None, toolbar_location="right",tools = "pan,wheel_zoom,box_zoom,reset,help")
p.circle([1, 2, 3, 4, 5], [2, 5, 8, 2, 7], size=10)
show(p)
我在 bokeh 文档中找不到有关 helptool 的信息。所有其他工具都有解释,但这个没有。我说的是工具栏中的这些工具:
http://docs.bokeh.org/en/latest/docs/user_guide/tools.html
我可以毫无问题地选择我想使用的大部分绘图工具。我想包括帮助工具,它在散景徽标之前清晰可见,但是我找不到任何直接引用它。 我刚刚测试了它(!),如果你想要帮助工具,它有一个“?” sybmol,如果您没有指定与绘图一起显示的工具,它只会默认包含在内。好的,我会接受这个,但我不会有“?”如果我选择工具。
我想我理解你的问题。您是说默认情况下工具面板将包含帮助工具。当您从头开始指定所有工具时,默认情况下不包括帮助工具。
如果您在未指定任何工具的情况下生成图,请列出图上的所有工具:
p.tools
>>>>
[PanTool(id='450f2e26-e0e5-4d90-89c4-44d20f2f688b', ...),
WheelZoomTool(id='84011ce1-4f73-4abb-abd1-26a830b70635', ...),
BoxZoomTool(id='adbfb29a-aa7d-4883-8f8f-d12b7c5af139', ...),
SaveTool(id='ff6ba8bb-c487-418d-82e5-28ff0402e2d6', ...),
ResetTool(id='dfac2559-da4c-4902-829d-f795ee0bfd56', ...),
HelpTool(id='1141330c-e9ff-4e5b-a737-3517c24f263e', ...)]
所以你可以看到有一个帮助工具。它也在文件中 http://docs.bokeh.org/en/latest/docs/reference/models/tools.html#bokeh.models.tools.HelpTool
因此您可以通过两种方式导入此工具并将其添加到绘图中:
from bokeh.plotting import figure, output_file, show
from bokeh.models import HelpTool
output_file("toolbar.html")
# create a new plot with the toolbar below
p = figure(plot_width=400, plot_height=400,
title=None, toolbar_location="below", tools="pan,wheel_zoom,box_zoom,reset")
p.add_tools(HelpTool())
p.circle([1, 2, 3, 4, 5], [2, 5, 8, 2, 7], size=10)
show(p)
或者更简单地说:
from bokeh.plotting import figure, output_file, show
output_file("toolbar.html")
# create a new plot with the toolbar below
p = figure(plot_width=400, plot_height=400,
title=None, toolbar_location="right",tools = "pan,wheel_zoom,box_zoom,reset,help")
p.circle([1, 2, 3, 4, 5], [2, 5, 8, 2, 7], size=10)
show(p)