Is it possible to re-draw the entire plot with new data from Bokeh streaming?


I am trying to figure out if I can use Bokeh’s streaming capabilities to automatically refresh an entire plot at certain time intervals. My figure is a heatmap made like this:

    fig = figure(x_range = ["01","02","03] ,y_range=["01","02","03"],
                  width=300,height=200,title="title",tools = [custom_hover])

   fig.rect('x', 'y', 0.95, 0.95, fill_alpha=0.6, source=source, color='color')

I have a periodic call back function (curdoc().add_periodic_callback(update_data,60000)) that updates the source and then streams it like this:, rollover=0)

My intention is to replace the heatmap with new data altogether. But what it does is, it just re-draws the new heatmap on top of the old. That messes up everything from values to color scheme to tool tips (which are replicated every time there’s an update until I have a super-long column of the same values when I hover over every cell).

Is what I am doing possible? Help would be appreciated!

Hi @hedgy123 please edit your post, plain text is formatted as code making one super long line, and it looks like not everything came through.