Hi.
I am plotting a volume plot. Like volume(vol; algorithm=:absorption)
But I want to update the plot with new data (nvol)!
But when I run volume!(nvol; algorithm=:absorption)
it adds the new data to the old data instead of replacing it. Is there a way to get volume!
to replace the data instead of adding it to the old data ?
This is how you animate in Makie:
https://docs.makie.org/stable/explanations/animation/
So, you need to do something like this:
fig, ax, pl = volume(...)
pl[1] = new_volume
1 Like
Thanks, your answer got me on the right track.
Here is an example I made.
`using GLMakie
f(x,y,z,k,v) = sin(k*cos(v)*x)sin(ksin(v)*y)cosh(kz)
xs, ys, zs = [-10:0.1:10 for d in range(1,3)]
vol = Observable([f(x,y,z,1.0,0.0) for x in xs, y in xs, z in zs])
fig=volume(xs,ys,zs,vol; colormap=:redsblues, colorrange=(-1000,1000),algorithm=:absorption)
display(fig)
for v = 0.0:0.1:pi
vol=[f(x,y,z,1.0,v) for x in xs, y in xs, z in zs]
println(“phi = $v”)
sleep(1)
end`
1 Like