[Makie] Observables, Animations, & an annoying plot workflow

I guess in this case, the easiest way would be to have a loop like this:

# Setup
fig = Figure()
ax = Axis(fig[1, 1])
t = 1 # assuming dim 2 is time or whatever ;) 
surfaces = map(1:N) do i
    return surface!(ax, x[i,t,:,:], y[i,t,:,:], q[i,t,:,:])
end
# update with new data:
t = 2
for (i, surf) in enumerate(surfaces)
    # via setindex, one can update the nth argument in a plot
    # a bit awkward to update all 3, since `plot[1:3] = (x, y, z)`` isn't overloaded
    setindex!.(p, (x[i,t,:,:], y[i,t,:,:], q[i,t,:,:]), 1:3)
end
yield() # don't forget to yield if the updating happens in a loop, so that the render task can draw a new image.
1 Like