Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bokeh updating multiple lines

Tags:

python

bokeh

From Painless Streaming Plots with Bokeh it shows how to stream live data of a single variable. How do you stream multiple lines where there is more than one y variable.

import time
from bokeh.objects import GlyphRenderer
renderer = [r for r in curplot().renderers if isinstance(r, GlyphRenderer)][0]
ds = renderer.data_source
while True:
    df = pd.io.json.read_json(url+json_call)
    ds.data["x"] = x+N*i
    ds.data["y"] = df.rssi
    ds._dirty = True
    session().store_obj(ds)
    time.sleep(1.5)
    i+=1
like image 645
Philliproso Avatar asked Oct 01 '22 08:10

Philliproso


1 Answers

You can update many ds.data[] items before calling session().store_objs(ds).

like image 181
Peter Wang Avatar answered Oct 05 '22 11:10

Peter Wang