, @bigreddot, push_notebook
( bokeh serve
). ; , . , , , if data_event:
while
, .
Bokeh Jupyter.
import time
import numpy as np
from bokeh.models.sources import ColumnDataSource
from bokeh.plotting import figure
from bokeh.io import output_notebook, show, push_notebook
output_notebook()
my_figure = figure(plot_width=800, plot_height=400)
test_data = ColumnDataSource(data=dict(x=[0], y=[0]))
line = my_figure.line("x", "y", source=test_data)
handle = show(my_figure, notebook_handle=True)
new_data=dict(x=[0], y=[0])
x = []
y = []
step = 0
step_size = 0.1
max_step = 10
period = .1
n_show = 10
while step < max_step:
x.append(step)
y.append(np.random.rand())
new_data['x'] = x = x[-n_show:]
new_data['y'] = y = y[-n_show:]
test_data.stream(new_data, n_show)
push_notebook(handle=handle)
step += step_size
time.sleep(period)
new_data['x'] = x = x[-n_show]
( y
), . , - (, ), . , , , , ββ , ; /. /, while
.