3
votes

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)
4

4 Answers

3
votes

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])
2
votes

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

1
votes
hv.extension("bokeh",logo=False)
0
votes

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)