I want to plot large data in one graph sample by sample. The newly sampled data should be added to the previous samples on the same plot. I have tried the code below, but it doesn’t work as intended. It only displays the current sample; it does not display all the previous samples. Any idea how to do it using bokeh?
import numpy as np
import time
from bokeh.plotting import *
from bokeh.session import Session
from random import randint
from bokeh.objects import GLyph,GridPlot, HoverTool
output_notebook(url="default")
#output_notebook()
figure(x_range=[0,1000000],y_range=[0,100],plot_width=1000,plot_height=600,title="Hello World!")
hold()
xs = []
ys = []
x = []
y = []
for num in range(0,1000000):
xs.append(num)
for num in range(0,1000000):
ys.append(randint(0,100))
scatter(x, y, color='#33A02C', fill_color=None, size=8)
renderer = [r for r in curplot().renderers if isinstance(r, Glyph)][0]
ds = renderer.data_source
show()
i = 0
iteration = 0
last = len(xs)
sampleSize = 1000
while(iteration <= len(xs)/sampleSize):
x = xs[i:i+sampleSize]
y = ys[i:i+sampleSize]
ds.data["x"] = x
ds.data["y"] = y
ds._dirty = True
cursession().store_objects(ds)
iteration = iteration + 1
i = i + sampleSize
The short answer is that there is currently not a way to incrementally patch or update a data source but that we will prioritize this after the upcoming 0.7 release.
Thanks,
Bryan
···
On Monday, December 1, 2014 7:09:53 AM UTC-6, Habtamu Aboma wrote:
I want to plot large data in one graph sample by sample. The newly sampled data should be added to the previous samples on the same plot. I have tried the code below, but it doesn’t work as intended. It only displays the current sample; it does not display all the previous samples. Any idea how to do it using bokeh?
import numpy as np
import time
from bokeh.plotting import *
from bokeh.session import Session
from random import randint
from bokeh.objects import GLyph,GridPlot, HoverTool
output_notebook(url="default")
#output_notebook()
figure(x_range=[0,1000000],y_range=[0,100],plot_width=1000,plot_height=600,title="Hello World!")
hold()
xs = []
ys = []
x = []
y = []
for num in range(0,1000000):
xs.append(num)
for num in range(0,1000000):
ys.append(randint(0,100))
scatter(x, y, color='#33A02C', fill_color=None, size=8)
renderer = [r for r in curplot().renderers if isinstance(r, Glyph)][0]
ds = renderer.data_source
show()
i = 0
iteration = 0
last = len(xs)
sampleSize = 1000
while(iteration <= len(xs)/sampleSize):
x = xs[i:i+sampleSize]
y = ys[i:i+sampleSize]
ds.data["x"] = x
ds.data["y"] = y
ds._dirty = True
cursession().store_objects(ds)
iteration = iteration + 1
i = i + sampleSize
The short answer is that there is currently not a way to incrementally patch or update a data source but that we will prioritize this after the upcoming 0.7 release.
Thanks,
Bryan
On Monday, December 1, 2014 7:09:53 AM UTC-6, Habtamu Aboma wrote:
I want to plot large data in one graph sample by sample. The newly sampled data should be added to the previous samples on the same plot. I have tried the code below, but it doesn’t work as intended. It only displays the current sample; it does not display all the previous samples. Any idea how to do it using bokeh?
import numpy as np
import time
from bokeh.plotting import *
from bokeh.session import Session
from random import randint
from bokeh.objects import GLyph,GridPlot, HoverTool
output_notebook(url="default")
#output_notebook()
figure(x_range=[0,1000000],y_range=[0,100],plot_width=1000,plot_height=600,title="Hello World!")
hold()
xs = []
ys = []
x = []
y = []
for num in range(0,1000000):
xs.append(num)
for num in range(0,1000000):
ys.append(randint(0,100))
scatter(x, y, color='#33A02C', fill_color=None, size=8)
renderer = [r for r in curplot().renderers if isinstance(r, Glyph)][0]
ds = renderer.data_source
show()
i = 0
iteration = 0
last = len(xs)
sampleSize = 1000
while(iteration <= len(xs)/sampleSize):
x = xs[i:i+sampleSize]
y = ys[i:i+sampleSize]
ds.data["x"] = x
ds.data["y"] = y
ds._dirty = True
cursession().store_objects(ds)
iteration = iteration + 1
i = i + sampleSize
–
You received this message because you are subscribed to the Google Groups “Bokeh Discussion - Public” group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].