Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 649
Bruno Avatar asked Dec 15 '25 05:12

Bruno


1 Answers

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)
like image 159
philippjfr Avatar answered Dec 16 '25 22:12

philippjfr



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!