33

Note from maintainers: The specifics of this question concern the bokeh.charts API which is obsolete and was removed several years ago. In modern Bokeh, specify toolbar_location:

p = figure(toolbar_location=None)


OBSOLETE:

I don't seem to be able to remove the toolbar from a bokeh Bar chart. Despite setting the tools argument to None (or False or '') I always end up with the bokeh logo and a grey line, e.g. with this code:

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)

However, when I try the same with a bokeh plot, it works perfectly fine and the toolbar is gone, e.g. with this code:

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)

Does anyone know what I'm doing wrong?

bigreddot
  • 33,642
  • 5
  • 69
  • 122
Arkady
  • 435
  • 1
  • 4
  • 9

2 Answers2

60

If you want to remove the logo and the toolbar you can do:

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

Hope this resolves your problem

Alex Poca
  • 2,406
  • 4
  • 25
  • 47
merqurio
  • 931
  • 12
  • 24
  • How can I remove the toolbar from a gridPlot, removing from suplots has no effect, removing gridplot is not possible: AttributeError: 'Column' object has no attribute 'toolbar' – user3598726 Jan 24 '18 at 11:21
  • 4
    toolbar_location=None, parameter of gridplot – Eoin Apr 11 '18 at 09:35
5

On any Bokeh plot object you can set:

p.toolbar_location = None
bigreddot
  • 33,642
  • 5
  • 69
  • 122
Luke Canavan
  • 2,107
  • 12
  • 13
  • I tried that too (mentioned it within the parenthesis saying that _False_ and _''_ don't work either). But you're right, according to the guide it should work. Unfortunately it still gives me the logo and the horizontal line... – Arkady Aug 25 '15 at 18:27
  • What version of Bokeh are you using? – Luke Canavan Aug 26 '15 at 19:51
  • `bokeh.__version__` gives me `0.9.2` – Arkady Aug 27 '15 at 20:38
  • sorry for my late reply - I didn't receive an e-mail after you edited your answer and simply thought that everyone forgot about my question... your answer is right, and I can remove the logo with `p.logo`, as @Merqurio pointed out – Arkady Sep 23 '15 at 05:33