How to completely replace data in a javascript plot


I’m trying to create a 3 dimensional animation of sorts that is interactive with user input. However, all of the examples I can find online are of 2d datasets that are appended to with new data (for example). I’m able to get new surfaces to show up on my plot, but I can’t actually get it to replace the old surface, it just adds a new one every iteration. I have tried relayout and update and both of them just create new surfaces when i change the data value instead of updating the old one. I figured I could just delete the trace and then try updating but delete trace doesn’t seem to do anything to the previous surfaces. Thank you for your time.

sike, turns out im just dumb and was not emptying my data array before adding new stuff to it, and therefore it added new surfaces because my data had new surfaces. it works just fine with update now.

@dmantacos welcome to the forums :wink:


Was able to get my DCM script working! still having trouble preventing it from auto-ranging but i’m sure ill figure it out