Update Makie plot in a loop

Hi,

I am looking for the equivalent of Plots.display() to update a plot in Atom Juno for example during a computation. I was suggested AbstractPlotting.inline!(false) but it did not seem to work.

Thank you for your help,

Bests

That depends on what you mean by “update”. Render a new static image into the plot pane? Then call AbstractPlotting.inline!(true) once and just display(fig) whenever you want to see a new image. Or execute whatever results in the Figure (or Scene, or FigureAxisPlot) again. AbstractPlotting.inline! is for switching between plotting in a GLMakie window, or returning a plot as an image.

Is it the kind of interactive plot you are after ?

You can replace the record line by the simple loop if you don’t want to generate a movie.

1 Like

The way I usually do this is to use Observables. This works great from the REPL, I haven’t tried with Juno.

using GLMakie
xs = 1:100
ys = Node(rand(length(xs)).-0.5);
plot(xs, ys)
for _ in 1:30
    ys[] = ys[] .+ 0.1*rand(length(xs)) .- 0.05
    sleep(0.1)
end
1 Like

No, I was asking for a solution for Atom Juno. I am testing @jules suggestion to see if I got it correctly.
However, you seem to answer a question I would have asked later for sure, namely the interaction of CuArrays and Makie… Thank you!

1 Like

Ok. So no opengl. Maybe the same with cairomakie ?

I got it! I am using GLMakie, sorry I am a newbie with Makie. I am trying to make a plot recipe for BifurcationKit.jl to plot 3d PDE solution as I am not satisfied with the 3d plots of Plots.jl.