Wednesday, 15 June 2011

IPython Modify Plot with Container Widget -


I am working with Ipython widgets to modify dynamically plotted data, so I The result is visible; Although I do not like the arrangement of widgets (slider and float box), I have tried to align them horizontally with the box and here's the problem because I do not know how the system passed That's the function, this way I get what you get in the image is I

  # I'll just put two sliders x = floatlider (0,1000) y = floatlider (0,1000) Interactive (function N, Xo = x, yo = y)  

If I try

  x = FloatSlider (0,1000,10) y = FloatSlider ( - 1,1,0.1) #this gives me the desired system co = HBox (children = [x, y]) interactive (function, xo = cochildren [0], yo = cockbrand [1])  

This only gives me an unscheduled result, and here's the place where I was trapped, I do not know how to make the container input to work with my conspiracy. Where's my fault What can i do

Enter image details here

< The following can solve your problem:

ip class = "post-text" itemprop = "text">

ipython.html.widgets import * x = FloatSlider (Value = 500.0, min = 0.0, max = 1000.0, phase = 10) y = floatlider (value = 0.0, min = -1.0, max = 1.0, phase = 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 the desired system F = interactive (function, x = x, y = y) Co = HBox (f.children) display (with)


No comments:

Post a Comment