Python Bokeh:从图表中删除工具栏

Python Bokeh:从图表中删除工具栏,python,bokeh,Python,Bokeh,维护人员注意:这个问题的细节涉及到bokeh.chartsAPI,它已经过时,并且在几年前就被删除了。在modern Bokeh中,指定工具栏\u位置: 过时: 我似乎无法从bokeh条形图中删除工具栏。尽管将tools参数设置为None(或False或“”),但我始终以bokeh徽标和一条灰线结束,例如,使用以下代码: from bokeh.charts import Bar, output_file, show # prepare some data data = {"y": [6,

维护人员注意:这个问题的细节涉及到
bokeh.charts
API,它已经过时,并且在几年前就被删除了。在modern Bokeh中,指定
工具栏\u位置



过时:

我似乎无法从bokeh条形图中删除工具栏。尽管将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)
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)
但是,当我尝试使用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)
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)

有人知道我做错了什么吗?

在任何Bokeh plot对象上,可以设置:

p.toolbar_location = None

如果要删除徽标和工具栏,可以执行以下操作:

p.toolbar.logo = None
p.toolbar_location = None

希望这能解决您的问题

我也试过(括号中提到False和“”也不起作用)。但你是对的,根据指南,它应该有效。不幸的是,它仍然给了我徽标和横线…你使用的是什么版本的Bokeh?
Bokeh.\uuuuuuuuuuuuuuuuu
给了我
0.9.2
很抱歉我回复太晚-在你编辑了你的答案后,我没有收到电子邮件,只是认为大家都忘了我的问题。。。你的答案是正确的,我可以用
p.logo
删除徽标,正如@Merqurio指出的那样,我如何从网格图中删除工具栏,从Suplot中删除没有效果,删除网格图是不可能的:AttributeError:“Column”对象没有属性“toolbar”toolbar\u location=None,gridPlot的参数