I am plotting a volume plot. Like
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:
So, you need to do something like this:
fig, ax, pl = volume(...)
pl = new_volume
Thanks, your answer got me on the right track.
Here is an example I made.
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)
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”)