4

I've been trying to embed bokeh charts in custom templates following this release updates here, examples zip

Now I'm trying out holoview as well and was wondering how I can embed holoview with bokeh renderer to custom templates. I'm not able to give name in holowview charts to achieve this

{{ embed(roots.mychart) }}

Appreciate any help if someone has already tried this out.

Venugopal Madathil
  • 2,031
  • 3
  • 34
  • 44

2 Answers2

3

name is a Bokeh level property, available on any Bokeh model. You should be able to set:

plot.name = "mychart"

on whatever Bokeh plot is returned by Holoviews.

bigreddot
  • 33,642
  • 5
  • 69
  • 122
1

In addition to bigreddot's answer if someone wants to know how to get bokeh chart from holoview

renderer = hv.renderer('bokeh')
myb = renderer.get_plot(holoviewplot).state
myb.name = 'mynewchart'
curdoc().add_root(myb)

And then in the template

{{ embed(roots.mynewchart) }}
Venugopal Madathil
  • 2,031
  • 3
  • 34
  • 44
  • 1
    Do you know how to get this working for a Holoview DynamicMap? – avg Dec 08 '18 at 12:23
  • any suggestion with Holoview DynamicMap ? Following is not working : `def get_plot(doc, x, y, df, name): vmap = dynspread(datashade(hv.curve(x, y)).opts(width=1200, height=600, tools=["hover"]) myplot = renderer.get_plot(vmap, doc).state myplot.name = name #plot = bk_lyout([[hvplot.state]], sizing_mode='scale_width') return myplot ` – Mukesh Kumar Aug 17 '20 at 22:10