multiple realtime lines in same figure

Hey guys,

Trying to figure out if I can plot two or more realtime lines in the same figure. Here is a slightly modified version of one of the examples given in the docs. As you can see, I’m trying to get “z” plotted but have been unable to get it working. I also tried multiple versions of this but thought maybe somebody has this already figured out. Thanks.

import time
import numpy as np
from bokeh.plotting import *
from bokeh.models import GlyphRenderer

x = [0.]
y = [0.]
z = [0.]

output_server(“simple_stream”)
p = figure(title=“simple brownian motion”)
p.line(x,y, color="#2222aa", line_width=1)
#p.line(x,z, color="#66aa22", line_width=1)

show§
ds = p.select({“type”: GlyphRenderer})[0].data_source
while True:
oldx = ds.data[“x”]
newx = np.hstack([oldx, [oldx[-1]+1]])
ds.data[“x”] = newx

oldy = ds.data["y"]
newy = np.hstack([oldy, [oldy[-1] + np.random.normal(0,1)]])
ds.data["y"] = newy

oldz = ds.data[“z”]

newz = np.hstack([oldz, [oldz[-1] + np.random.normal(0,1)]])

ds.data[“z”] = newz

cursession().store_objects(ds)
time.sleep(0.1)

``