# Update Makie plot in a loop

**URL:** <https://discourse.julialang.org/t/update-makie-plot-in-a-loop/56911>\
**Category:** General Usage\
**Tags:** makie\
**Created:** [March 10, 2021, 8:08pm UTC](https://discourse.julialang.org/t/update-makie-plot-in-a-loop/56911 "2021-03-10T20:08:30Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![rveltz](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rveltz/32/2707_2.png) [@rveltz](https://discourse.julialang.org/u/rveltz)\
**Post date:** [March 10, 2021, 8:08pm UTC](https://discourse.julialang.org/t/update-makie-plot-in-a-loop/56911/1 "2021-03-10T20:08:31Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://discourse.julialang.org/u/jules)\
**Post date:** [March 10, 2021, 8:31pm UTC](https://discourse.julialang.org/t/update-makie-plot-in-a-loop/56911/2 "2021-03-10T20:31:27Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![LaurentPlagne](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/laurentplagne/32/10103_2.png) [@LaurentPlagne](https://discourse.julialang.org/u/LaurentPlagne)\
**Post date:** [March 10, 2021, 8:54pm UTC](https://discourse.julialang.org/t/update-makie-plot-in-a-loop/56911/3 "2021-03-10T20:54:52Z")

</div>

Is it the kind of interactive plot you are after ?

> [@CuArray + GLMakie](https://discourse.julialang.org/t/cuarray-glmakie/52461/4):
>
> Hi Simon, Here is an example which is unfortunately a bit too long for the 7-lines thread… Anyway, It takes about 5s on my machine to run and show a rather convincing combination of CUDA.jl and Makie.jl. In the plot (can be heatmap or surface), I copy the CuArray zs to a standard Array czs… [toto] using CUDA,GLMakie,AbstractPlotting const T=Float32 const V=CuArray{T,2} function go() CUDA.allowscalar(false) ls,ns,ms,λ,dt,sr,k,nt,two,eight,fr =1.e-2,800,1.e-4,0.1,2.e-7,0.1,5e7,5000,T(…

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

---

<div class="post-metadata">

**Author:** ![contradict](https://avatars.discourse-cdn.com/v4/letter/c/ac91a4/32.png) [@contradict](https://discourse.julialang.org/u/contradict)\
**Post date:** [March 10, 2021, 8:58pm UTC](https://discourse.julialang.org/t/update-makie-plot-in-a-loop/56911/4 "2021-03-10T20:58:59Z")

</div>

The way I usually do this is to use [Observables](https://makie.juliaplots.org/stable/interaction.html). This works great from the REPL, I haven’t tried with Juno.

```julia
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

```

---

<div class="post-metadata">

**Author:** ![rveltz](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rveltz/32/2707_2.png) [@rveltz](https://discourse.julialang.org/u/rveltz)\
**Post date:** [March 10, 2021, 8:59pm UTC](https://discourse.julialang.org/t/update-makie-plot-in-a-loop/56911/5 "2021-03-10T20:59:30Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![LaurentPlagne](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/laurentplagne/32/10103_2.png) [@LaurentPlagne](https://discourse.julialang.org/u/LaurentPlagne)\
**Post date:** [March 10, 2021, 9:02pm UTC](https://discourse.julialang.org/t/update-makie-plot-in-a-loop/56911/6 "2021-03-10T21:02:54Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![rveltz](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rveltz/32/2707_2.png) [@rveltz](https://discourse.julialang.org/u/rveltz)\
**Post date:** [March 10, 2021, 9:06pm UTC](https://discourse.julialang.org/t/update-makie-plot-in-a-loop/56911/7 "2021-03-10T21:06:09Z")

</div>

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](https://github.com/rveltz/BifurcationKit.jl) to plot 3d PDE solution as I am not satisfied with the 3d plots of `Plots.jl`.
