Bruno
Bruno

Reputation: 97

Adding a Rendered Holoview Plot to an interactive Bokeh APP

Is it possible to integrate a Holoviews Plot to an existing Bokeh APP and update its data using widgets the same way it is done with ordinary Bokeh Plots?

for example, I would like to do something like this:


    ### Creating a Chord Plot from Holoviews     
    p_holo=hv.Chord(pd.DataFrame(dic_plot))

    ### Rendering to Bokeh Figure
    p=hv.render(p_holo)

    ...

    ### Defining a callback for changing Holoviews Plot data:
    def update_holo_data():
       ...
       p.data=new_data

Upvotes: 3

Views: 339

Answers (1)

philippjfr
philippjfr

Reputation: 4080

No, HoloViews is explicitly not designed around callbacks instead following a reactive pattern. The way to set this up is using a DynamicMap and streams, specifically the Pipe stream:

def callback(data):
    return hv.Chord(pd.DataFrame(data))

stream = hv.streams.Pipe(data=dic_plot)

dmap = hv.DynamicMap(callback, streams=[stream])

p = hv.render(dmap)

stream.send(new_data)

Upvotes: 4

Related Questions