On Mon, Aug 3, 2015 at 12:30 AM, Júlio Hoffimann <[email protected]> wrote:
> Hi Shashi, thank you very much for your help. > > What is slider_val in your code snippet? I actually have multiple sliders > and other widgets that I want to play with before plotting. Is there any > version of @manipulate where I can pass all sorts of widgets at once? > > @manipulate slider, checkbox, togglebuttons, ... withfig() do > ... plot commands ... > end > > -Júlio > > 2015-08-02 11:51 GMT-07:00 Shashi Gowda <[email protected]>: > >> Hi, >> >> Easiest way to do this is with @manipulate and `withfig` as you have >> discovered. >> >> I'm inclined to remove @lift from reactive since it's hard to implement >> correctly and has caused frustrating problems. (also it's not eval-free) >> >> I recommend you use the lift function instead. >> >> s = slider(1:10) >> display(s) >> lift(x -> greyim(eye(x)), s) >> >> Should do the trick for you. >> >> With PyPlot, this will be: >> >> f = figure() >> lift(s) do slider_val >> withfig(f) # This basically says "do the drawing on the same plot f." >> .... plot something with slider_val... >> end >> >> >> slider_val is the argument to the do block. You can do: lift(widget1, widget2, widget3) do a, b, c withfig(f) # This basically says "do the drawing on the same plot f." .... a, b, c are widget values... end or @manipulate for a=slider(1:3), b=slider(2:4), c=checkbox() ...use a,b,c here... end >> >> >> >> On Mon, Aug 3, 2015 at 12:06 AM, Júlio Hoffimann < >> [email protected]> wrote: >> >>> Hi, >>> >>> Suppose I have: >>> >>> s = slider(1:10) >>> img = @lift eye(s) >>> >>> How can I create the interactive plot in Jupyter using @lift? >>> >>> @lift imshow(img) >>> >>> I know @manipulate has the withfig() option where we can pass the PyPlot >>> Figure object, what about @lift? >>> >>> -Júlio >>> >> >> >
