Example #1
0
pantool = PanTool(dataranges = [xdr, ydr], dimensions=["width","height"])
zoomtool = ZoomTool(dataranges=[xdr,ydr], dimensions=("width","height"))

plot.renderers.append(renderer)
plot.renderers.append(renderer2)
plot.tools = [pantool, zoomtool]

sess = session.PlotServerSession(
    username="******",
    serverloc="http://localhost:5006", userapikey="nokey")
sess.use_doc("line_animate")
sess.add(plot, renderer, renderer2, xaxis, yaxis, 
         source, xdr, ydr, xdr_static, pantool, zoomtool)
sess.plotcontext.children.append(plot)
sess.plotcontext._dirty = True
# not so nice.. but set the model doens't know
# that we appended to children
sess.store_all()

print("Stored to document line_animate at http://localhost:5006/bokeh")

while True:
    for i in  np.linspace(-2*pi, 2*pi, 50):
        source._data['x'] = x +i
        source._dirty = True
        sess.store_all()
        time.sleep(0.05)



Example #2
0
wheelzoomtool = WheelZoomTool(dimensions=["width", "height"])

plot.renderers.append(renderer)
plot.renderers.append(renderer2)
plot.tools = [pantool, wheelzoomtool]

try:
    sess = session.PlotServerSession(serverloc="http://localhost:5006",
                                     username="******",
                                     userapikey="nokey")
except requests.exceptions.ConnectionError:
    print(
        "ERROR: This example requires the plot server. Please make sure plot server is running, by executing 'bokeh-server'"
    )
    sys.exit(1)

sess.use_doc("line_animate")
sess.add_plot(plot)
# not so nice.. but set the model doens't know
# that we appended to children
sess.store_all()

print("Stored to document line_animate at http://localhost:5006/bokeh")

while True:
    for i in np.linspace(-2 * pi, 2 * pi, 50):
        source._data['x'] = x + i
        source._dirty = True
        sess.store_all()
        time.sleep(0.05)