5

Is it possible to remove the Bokeh logo from plots generated with HoloViews? Nothing against it... it's just that it may not make sense to display it in certain reports. :)

I know that in Bokeh I can simply do:

p = bkp.figure(...)
...
p.toolbar.logo = None

UPDATE

Here's my import section:

import sys
import os

import numpy as np
np.random.seed(0)
import random
random.seed(0)

import pandas as pd
from bokeh.models import HoverTool
import holoviews as hv
hv.extension("bokeh", logo=False)
Bruno
  • 1,329
  • 2
  • 15
  • 35

4 Answers4

3

Currently (as of holoviews 1.9.1) the option to disable the bokeh logo in the toolbar is not directly exposed, but you can supply a so called finalize_hook which lets you modify the plot directly. You can add such a hook directly on the ElementPlot to set it globally:

def disable_logo(plot, element):
    plot.state.toolbar.logo = None
hv.plotting.bokeh.ElementPlot.finalize_hooks.append(disable_logo)

or set it as a plot option:

hv.Curve(range(10)).opts(plot=dict(finalize_hooks=[disable_logo])
philippjfr
  • 3,997
  • 14
  • 15
  • Quick comment. That worked for an overlay plot I created (e.g., A * B * C), but it didn't work for a composed plot of overlay objects (e.g., (C + D).cols(1), where C = A1 * B1 and D = A2 * B2). I still see the Bokeh logo in the latter case. – Bruno Dec 02 '17 at 15:00
2
hv.extension("bokeh",logo=False)
Sraw
  • 18,892
  • 11
  • 54
  • 87
James A. Bednar
  • 3,195
  • 1
  • 9
  • 13
  • Thanks for the quick response, James! But that didn't work for me... I still see the Bokeh logo after creating overlay plots in Jupyter notebook. By the way, I attended your webinar yesterday and it was excellent! I'm excited to learn more about HoloViews and Datashader. Keep up the great work! – Bruno Dec 01 '17 at 03:07
  • Currently we don't expose this option directly you could disable it globally for now by adding a hook to that effect. See my post for details. – philippjfr Dec 01 '17 at 04:08
  • D'oh! I didn't read the question closely enough; logo=False is about the logo at the top of the notebook, not the one on each plot as you're asking about. – James A. Bednar Dec 02 '17 at 06:38
2

To remove the Bokeh logo for more complicated layouts, I think you need to render it to a Bokeh figure, and then use Bokeh's native method to remove it.

layout = C + D
plot = renderer.get_plot(layout)
p = plot.state
p.children[0].toolbar.logo = None
show(p)

Remove Bokeh Logo for Layout

Stephen Rauch
  • 47,830
  • 31
  • 106
  • 135
Andrew
  • 507
  • 5
  • 16
2

1) This is almost the same as philippjfr answer, but slightly shorter using hooks:

def remove_bokeh_logo(plot, element):
    plot.state.toolbar.logo = None

hv.Scatter(df).opts(hooks=[remove_bokeh_logo])


2) And there's Andrew's answer, rendering the plot as bokeh and then removing the logo:

from bokeh.plotting import show

hv_plot = hv.Scatter(df)
bokeh_plot = hv.render(hv_plot, backend='bokeh')
bokeh_plot.toolbar.logo = None

show(bokeh_plot)
Sander van den Oord
  • 10,986
  • 5
  • 51
  • 96