I tried Interact.jl, and it's really fun!  Here is code that does a contour 
plot of Helmholtz with a slider for different wave numbers, where ny is the 
discretization in y.  (nx = ∞, which means adaptive). 


Pkg.add(“Interact”)
Pkg.add(“Gadfly”)
Pkg.add(“ApproxFun”)
Pkg.checkout(“ApproxFun”)
using ApproxFun,Interact


d=Interval()⊗Interval()
B=dirichlet(d)
Δ=lap(d)

@manipulate for k=-100.0:.01:2000.0,ny=10:200
    contour(pdesolve([B,Δ+k*I],[1.,1.,1.,1.],ny))
end


On 1 Sep 2014, at 8:21 pm, Shashi Gowda <[email protected]> wrote:

> @Sheehan
> 
> There is now Interact.jl (Pkg.add("Interact")) which lets you travel your 
> for-loops with sliders and such widgets, to put it one way. Here's an example 
> notebook showing how you can do interactive plotting with Gadfly or PyPlot: 
> http://nbviewer.ipython.org/github/JuliaLang/Interact.jl/blob/master/doc/notebooks/Interactive%20Plotting.ipynb
> 
> 
> 
> On Mon, Sep 1, 2014 at 12:28 PM, Sheehan Olver <[email protected]> wrote:
> 
>       Got GLPlot working, it's awesome!  The following does a movie of a 
> solution to wave equation on a square using latest version of ApproxFun (the 
> color is weird since I haven't figured that part out yet):
> 
> 
> 
> window = createdisplay(w=1000,h=1000,eyeposition=Vec3(1,1,1), lookat=Vec3(0))
> 
> function zcolor(i, j, t)
>       x               = float32(i - 0.5)
>       z               = float32(j - 0.5)
>       radius  = sqrt((x * x) + (z * z))
> 
>       r = sin(10.0f0 * radius + t)
>     g = cos(10.0f0 * radius + t)
>     b = radius
>     return Vec4(r,g,b, 1)
> end
> yy=xx=-1.:.05:1.
> N=length(xx)
> color     = [zcolor(i/N, j/N, 15) for i=1:N, j=1:N];
> 
> 
> h=0.01;
> u0=TensorFun((x,y)->exp(-10x.^2-20(y-.1).^2))
> d=Interval()⊗Interval()
> L=I-h^2*lap(d);
> B=dirichlet(d);
> S=schurfact([B,L],80);
> 
> u=Array(TensorFun,10000)
> u[1]=u0
> u[2]=u0
> n=2;
> 
> 
> GLPlot.glClearColor(1,1,1,0)
> m=400
> for k=n+1:n+m
>     u[k]=(S\[zeros(4),2u[k-1]-u[k-2]])
>     vals=[u[k][x,y] for x in xx,y in yy];
>     texdata=map(Vec1,vals)
>     obj       = glplot(texdata, primitive=SURFACE(), color=color);
>     GLPlot.glClear(GLPlot.GL_COLOR_BUFFER_BIT | GLPlot.GL_DEPTH_BUFFER_BIT)
>     render(obj)
>     yield()
>      GLFW.SwapBuffers(window.glfwWindow)
> end
> n+=m
> 
> On 21 Aug 2014, at 9:51 am, Simon Danisch <[email protected]> wrote:
> 
>> Good to hear.
>> The test looks funny, as I overlay everything GLPlot is able to do ;)
>> I should remove example.jl, as it uses legacy code.
>> I'm not sure about the surface example, though... Did you change anything?
>> This might be due to a change of the output from imread (Images.jl) and 
>> shouldn't be a problem if you use your own arrays.
>> I'll have a look at this tomorrow...
>> 
>> 
>> 2014-08-20 23:58 GMT+02:00 Sheehan Olver <[email protected]>:
>> OK I rebuilt julia and cleared my .julia folder, which seems to have cleared 
>> that issue.  Pkg.test(“GLPlot”) seems to work, though the output looks 
>> funny.   I also get the following:
>> 
>> julia> include("surface.jl")
>> INFO: loaded GLFW 3.0.4 Cocoa NSGL chdir menubar dynamic from 
>> /Users/solver/.julia/v0.4/GLFW/deps/usr64/lib/libglfw
>> ERROR: Color Format RGBA not supported
>>  in error at error.jl:21
>>  in Texture at /Users/solver/.julia/v0.4/GLAbstraction/src/GLTexture.jl:156
>>  in include at ./boot.jl:245
>>  in include_from_node1 at ./loading.jl:128
>> while loading /Users/solver/.julia/v0.4/GLPlot/example/surface.jl, in 
>> expression starting on line 24
>> 
>> julia> include("example.jl")
>> INFO: loaded GLFW 3.0.4 Cocoa NSGL chdir menubar dynamic from 
>> /Users/solver/.julia/v0.4/GLFW/deps/usr64/lib/libglfw
>> ERROR: Cam not defined
>>  in include at ./boot.jl:245
>>  in include_from_node1 at ./loading.jl:128
>> while loading /Users/solver/.julia/v0.4/GLPlot/example/example.jl, in 
>> expression starting on line 25
>> 
>> 
>> On 20 Aug 2014, at 9:37 pm, Tim Holy <[email protected]> wrote:
>> 
>> > You might need a Pkg.update(), or Pkg.build("Images") if the update doesn't
>> > solve it.
>> >
>> > --Tim
>> >
>> > On Wednesday, August 20, 2014 09:23:16 PM Sheehan Olver wrote:
>> >> OK Now I get
>> >>
>> >> could not open file
>> >> /Users/solver/.julia/v0.3/Images/src/ioformats/../../deps/deps.jl while
>> >> loading /Users/solver/.julia/v0.3/Images/src/ioformats/libmagickwand.jl, 
>> >> in
>> >> expression starting on line 24 while loading
>> >> /Users/solver/.julia/v0.3/Images/src/Images.jl, in expression starting on
>> >> line 38 while loading
>> >> /Users/solver/.julia/v0.3/GLAbstraction/src/GLTexture.jl, in expression
>> >> starting on line 1 while loading
>> >> /Users/solver/.julia/v0.3/GLAbstraction/src/GLTypes.jl, in expression
>> >> starting on line 40 while loading
>> >> /Users/solver/.julia/v0.3/GLAbstraction/src/GLAbstraction.jl, in 
>> >> expression
>> >> starting on line 8
>> >> On 20 Aug 2014, at 9:06 pm, Simon Danisch <[email protected]> wrote:
>> >>> Yes I do =)
>> >>> You need to install Images.jl properly with its dependency.
>> >>> https://github.com/timholy/Images.jl
>> >>> I should at some point load this conditional, as you don't really need
>> >>> Images.jl as long as you don't read images from your HD.
>> >>>
>> >>>
>> >>> 2014-08-20 13:01 GMT+02:00 Sheehan Olver <[email protected]>:
>> >>> OK I cloned all the necessary projects but get the following error on OS
>> >>> X, and thoughts?
>> >>>
>> >>> julia> include("surface.jl")
>> >>> ERROR: error compiling Texture: error compiling __Texture#30__: error
>> >>> compiling imread: error compiling imread: error compiling MagickWand:
>> >>> could not load module : dlopen(.dylib, 1): image not found>
>> >>> in GLFont at /Users/solver/.julia/v0.3/GLText/src/types.jl:97
>> >>> in inittext at /Users/solver/.julia/v0.3/GLText/src/GLText.jl:13
>> >>> in init_glutils at
>> >>> /Users/solver/.julia/v0.3/GLAbstraction/src/GLInit.jl:13
>> >>> in createwindow at
>> >>> /Users/solver/.julia/v0.3/GLWindow/src/reactglfw.jl:299
>> >>> in createdisplay at /Users/solver/.julia/v0.3/GLPlot/src/GLPlot.jl:43
>> >>> in include at ./boot.jl:245
>> >>> in include_from_node1 at ./loading.jl:128
>> >>>
>> >>> while loading /Users/solver/.julia/v0.3/GLPlot/example/surface.jl, in
>> >>> expression starting on line 3>
>> >>> On 20 Aug 2014, at 8:37 pm, Simon Danisch <[email protected]> wrote:
>> >>>> In theory it does support 2D plotting, but I didn't invest much work 
>> >>>> into
>> >>>> it, as 3D is my main focus. In other words:
>> >>>> There's nothing working out of the box, but if you are willing to invest
>> >>>> some work, there are already a lot of tools to make 2D plotting possible
>> >>>> and I would be willing to support you with any efforts.
>> >>>>
>> >>>>
>> >>>> Am Dienstag, 19. August 2014 07:46:22 UTC+2 schrieb Sheehan Olver:
>> >>>> Hi,
>> >>>>
>> >>>> Is there a way to force plotting in PyPlot.jl, to simulate animation?
>> >>>> Right now if I do a for loop over a sequence of plots, it only outputs
>> >>>> the last plot.
>> >>>>
>> >>>> This is in IJulia running on OS X with matplotlib version 1.3.1
>> >>>> installed, and pygui(true)
>> >>>>
>> >>>> Sheehan
>> >
>> 
>> 
> 
> 

Reply via email to