IPython Modify Plot with Container Widget -
i'm working ipython widgets modify dynamically plotted data, result seen in image; dont arrangment of widgets (sliders , float boxes) have tried align them horizontally box
, here trouble because don't know how pass arrangment function, how obtain see in image
#i'm going put 2 sliders x= floatslider(0,1000) y= floatslider(0,1000) interactive(function,xo=x,yo=y)
if try
x= floatslider(0,1000,10) y= floatslider(-1,1,0.1) #this gives me desired arrangment co = hbox(children=[x,y]) interactive(function,xo=co.children[0],yo=co.children[1])
this gives me same unordered result, , here got stuck, don't know how input container make work plot. error? can do?
the following might solution problem:
from ipython.html.widgets import * x = floatslider(value = 500.0, min=0.0, max=1000.0, step=10) y = floatslider(value = 0.0, min=-1.0, max=1.0, step=0.1) plt.xlim(0,1) plt.ylim(-1,1) def function(x, y): plt.plot([0.0, 1.0], [-1.0, 1.0], 'b.') plt.plot(x/1000.0, y, 'o') #this gives me desired arrangment f = interactive(function, x=x, y=y) co = hbox(f.children) display(co)
Comments
Post a Comment