Skip to content

Instantly share code, notes, and snippets.

@pierrelux
Created April 17, 2015 21:00
Show Gist options
  • Save pierrelux/ddc288e88418ab305ef9 to your computer and use it in GitHub Desktop.
Save pierrelux/ddc288e88418ab305ef9 to your computer and use it in GitHub Desktop.
Streaming plot in Bokeh
import time
import numpy as np
from bokeh.plotting import *
output_server("line_animate")
p = figure()
p.line([], [], color="#3333ee", name="My stream")
show(p)
renderer = p.select(dict(name="My stream"))
ds = renderer[0].data_source
for i in range(10):
ds.data["x"].append(i)
ds.data["y"].append(np.random.random())
cursession().store_objects(ds)
time.sleep(0.05)
push()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment