Adding a point to a dynamic plot the whole dataset visualization is squeezed to accomodate all points.
How is it possible to show only the last, say, 10000 points without removing older points from the dataset?
I am missing this figure property and I am sure it is under my nose…
This is the code, taken from http://stackoverflow.com/questions/37724660/streaming-two-line-graphs-using-bokeh
#!/usr/bin/python
-- coding: utf-8 -
myplot.py
from bokeh.plotting import figure, curdoc
from bokeh.driving import linear
import random
p = figure(plot_width=400, plot_height=400)
r1 = p.line(, , color=“firebrick”, line_width=2)
r2 = p.line(, , color=“navy”, line_width=2)
ds1 = r1.data_source
ds2 = r2.data_source
@linear()
def update(step):
ds1.data[‘x’].append(step)
ds1.data[‘y’].append(random.randint(0,100))
ds2.data[‘x’].append(step)
ds2.data[‘y’].append(random.randint(0,100))
ds1.trigger(‘data’, ds1.data, ds1.data)
ds2.trigger(‘data’, ds2.data, ds2.data)
curdoc().add_root(p)
curdoc().add_periodic_callback(update, 100)
``
