And here is the working code:

[1]
using Gadfly,Reactive,Interact,PyPlot
myfig = figure()
function myplot(data)
    withfig(myfig) do
        PyPlot.plot(data[1], data[2])
        axis([0,1,-.3,.3])
    end
end
x = linspace(0,1,100)
myinput=Input((x,0*x))
lift(myplot, myinput)

[2]
x = linspace(0,1,100)
for t = -1:.1:1
    y = t * x .*(1-x)
    push!(myinput,(x, y))
end


On Thursday, 27 November 2014 21:11:22 UTC, Christoph Ortner wrote:
>
> Hi Steven,
>
> That worked! Thank you.
>
> (Though admittedly I did not fully understand your explanation.)
>
> All the best, 
>     Christoph
>
> On Thursday, 27 November 2014 19:04:12 UTC, Steven G. Johnson wrote:
>>
>> PyPlot, like the Python package of the same name, plots as a side effect. 
>> You can use the withfig function to wrap PyPlot commands and make them 
>> functional (returning the figure object as the withfig return value rather 
>> than displaying it as a side effect). This allows Pyplot to be used with 
>> @manipulate, but should also work with other Reactive functions. 
>
>

Reply via email to