Just to say, this is not simply a case of replacing deprecated lift and
Input; the push! fails for me; does anyone else have this problem?
In the end, I succeeded in getting the results I wanted by tweaking the
code in OP's first post; see two versions (interactive and non-interactive)
below.
*Interactive version:*
using PyPlot
pygui(true)
x = linspace(0,1,100)
PyPlot.hold(false)
for t = -1:.1:1
IJulia.clear_output(true)
p = plot(x, t*(1-x).*x)
axis([0,1, -.3, .3])
PyPlot.draw()
end
*Inline version*:
using PyPlot
pygui(false)
x = linspace(0,1,100)
PyPlot.hold(false)
for t = -1:.1:1
IJulia.clear_output(true)
plot(x, t*(1-x).*x)
axis([0,1, -.3, .3])
display(gcf())
end
On Monday, 25 July 2016 15:23:23 UTC+2, Thomas Hudson wrote:
>
> Since Julia 0.4.6, this solution no longer seems to work: the code reverts
> to plotting only the final frame calculated.
>
> Does anyone have any idea how to tweak the code and get identical
> on-the-fly plotting behaviour with PyPlot under Julia 0.4.6?
>
> Thanks for any help you can give,
>
> Tom
>
> On Thursday, 27 November 2014 22:12:14 UTC+1, Christoph Ortner wrote:
>>
>> 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.
>>>
>>>