Hey, I wrote the following program that basically updates a graph with a random new value as time passes.
import time
import random
from random import shuffle
from bokeh.plotting import figure, output_server, cursession, show, Session
session = Session(root_url=‘http://127.0.0.1:5006/’, load_from_config=False)
session.register(‘anon3’, ‘1234’)
session.login(‘anon’, ‘1234’)
output_server(“animated_line”)
a = random.random()*10
b = random.random()*10
p = figure(plot_width=1000, plot_height=600)
p.xaxis.bounds = (1,100)
p.line([0], [a], name=‘ex_line1’)
p.line([0], [b], name=‘ex_line2’)
show(p)
renderer1 = p.select(dict(name=“ex_line1”))
ds1 = renderer1[0].data_source
renderer2 = p.select(dict(name=“ex_line2”))
ds2 = renderer2[0].data_source
i = 0
while True:
a1 = random.random()*10
b1 = random.random()*10
ds1.data[“x”].append(i)
ds2.data[“x”].append(i)
ds1.data[“y”].append(a1)
cursession().store_objects(ds1)
cursession().store_objects(ds2)
time.sleep(0)
i+= 1
The problem is that the axes sorta squish up as the values begin to get large (as shown here: Screen capture - 30be6427d6a2308219d9fbf2cb9a25c5 - Gyazo )
I was wondering if there’s a way for us to manually adjust the window so that we can choose the portion to focus on at each specific moment. Thanks!