opened 03:14PM - 25 Feb 16 UTC
closed 04:39AM - 21 Jun 16 UTC
type: bug
reso: completed
Hi,
I'd like to use the bokeh-client to start off with an initial plot in my ht…ml. Then every few seconds
I want to add an additional plot and have it appear without reloading the page.
Here an example I created where I try to do it. The document is created with one plot inside a VBox, every second an additional plot is added to the VBox:
``` python
from bokeh.plotting import figure, show, output_file, output_server
from bokeh.document import Document
from bokeh.client import push_session
from bokeh.io import curstate, curdoc
from bokeh.models.layouts import VBox
curstate().autoadd = False
import time
import numpy as np
x = np.linspace(0, 4*np.pi, 100)
y = np.sin(x)
document = Document()
# create first plot
plot = figure( y_range=(-1.2, 1.2) )
plot.line(x,y,line_width=2, legend="x")
# add plot to the layout
layout = VBox(children=[plot])
document.add_root(layout)
session = push_session(document)
output_server("example.html")
session.show()
for i in range(5):
time.sleep(1)
# create additional plots
plot2 = figure( y_range=(-1.2, 1.2) )
plot2.line(x,y,line_width=2, legend="x")
# add additional plots to the layout
layout.children.append(plot2)
```
However I guess doing **layout.children.append** is kind of a hack. The first plot is completely correct, but the additional plots are empty:

Is there a proper way to achieve what iam trying to do here?