Updating embedded bokeh plots and pop-in

Hey guys,

I’m trying to update embedded plots using Django and intercooler.js. Basically, I have a page that embeds a bokeh chart using something like this (taken from the bokeh docs):

from bokeh.plotting import figure
from bokeh.embed import components

plot = figure()
plot.circle([1,2], [3,4])

script, div = components(plot)

``

This script and div tag are then put into a template with something like this:

{{script|safe}} {{div|safe}}

``

So far, so good. This works well. I have gone a step further by using intercooler.js to update the template above when a button is clicked on the page. This means that I replace that section of the page (but not the entire page) with a new plot.

My problem is that, when the button is pressed, the plot disappears for ~0.3 seconds, during that time, any elements after the plot are shifted upwards. After the ~0.3 seconds, the plot pops back in and everything is ok.

Is there a way to fix this pop-out/pop-in behavior? It’s really grating from a user experience perspective.