In [165]:
from bokeh.models.widgets import RadioGroup
from bokeh.io import output_file, show, vform, push_notebook
from bokeh.models import CustomJS, ColumnDataSource, Slider
from bokeh.plotting import figure,Figure, output_file, show, output_notebook, gridplot
from ipywidgets import interact
import numpy as np
In [166]:
N=10000
x = np.linspace(0,100,10000)
y1 = np.random.normal(loc=10,scale=1.5,size=N)
y2 = np.random.normal(loc=10.2, scale=0.4,size=N)
source = ColumnDataSource(data=dict(x=x,y1=y1,y2=y2))
In [167]:
output_notebook()
In [168]:
p1 = figure(title='test1', plot_height=400, plot_width=400, y_range=(-5,5), webgl=True)
p2 = figure(title='test2', plot_height=400, plot_width=400, y_range=p1.y_range, x_range=p1.x_range, webgl=True)
In [169]:
r1 = p1.circle('x','y1',source=source)
r2 = p2.circle('x','y2',source=source)
plot = gridplot([[p1,p2]])
In [170]:
def update(mu1=1,sigma1=1,mu2=0,sigma2=1.5,number=10000):
r1.data_source.data['y1'] = np.random.normal(mu1,sigma1,number)
r2.data_source.data['y2'] = np.random.normal(mu2,sigma2,number)
print "TEST1 stats:"
print np.mean(r1.data_source.data['y1'])
print np.std(r1.data_source.data['y1'])
print "TEST2 stats:"
print np.mean(r1.data_source.data['y2'])
print np.std(r1.data_source.data['y2'])
push_notebook()
In [171]:
show(plot)
Out[171]:
In [172]:
interact(update, mu1=(0,10,0.1), sigma1=(0.1,10,0.1), mu2=(0,10,0.1), sigma2=(0.1,10,0.1))
In [ ]: