维护者的注意事项:这个问题的具体内容涉及到已经过时并且在几年前就被移除的bokeh.charts
API。在现代的Bokeh中,请使用toolbar_location
进行指定:
p = figure(toolbar_location=None)
过时内容:
我似乎无法从bokeh Bar图表中删除工具栏。尽管将tools参数设置为None(或False或''),但最终总是有bokeh的标志和一条灰线,例如使用以下代码:
from bokeh.charts import Bar, output_file, show
# prepare some data
data = {"y": [6, 7, 2, 4, 5], "z": [1, 5, 12, 4, 2]}
# output to static HTML file
output_file("bar.html")
# create a new line chat with a title and axis labels
p = Bar(data, cat=['C1', 'C2', 'C3', 'D1', 'D2'], title="Bar example",
xlabel='categories', ylabel='values', width=400, height=400,
tools=None)
# show the results
show(p)
然而,当我尝试使用一个bokeh plot时,它完美地工作,并且工具栏消失了,例如使用以下代码:
from bokeh.plotting import figure, output_file, show
output_file("line.html")
p = figure(plot_width=400, plot_height=400, toolbar_location=None)
# add a line renderer
p.line([1, 2, 3, 4, 5], [6, 7, 2, 4, 5], line_width=2)
show(p)
有人知道我做错了什么吗?