I’ve been trying to solve this my self for a while and did some research, but wasn’t able to find the answer.
I need to animate a 3D surface plot. I have a 3-dimentional array of data for u(x, y, t), so I want to plot u(x, y) for each t and then observe the animation. I found a work around that I don’t really like. Do you guys know is there a proper way of doing the same in plotly? Here is my solution:
from plotly.offline import iplot
import ipywidgets as widgets
from IPython.display import display
fig = go.FigureWidget(layout = layout)
surface = fig.add_surface(x = solver.x, y = solver.y, z=solver.u.T, colorscale = ‘YlGnBu’)
fig.layout.scene.zaxis.range = [np.min(solver.u), np.max(solver.u)]
fig.layout.scene.yaxis.range = [solver.Y_START, solver.Y_END]
fig.layout.scene.xaxis.range = [solver.X_START, solver.X_END]
surface.z = solver.u[i].T
for i in range(solver.J):
as you can see it will only work once when running the last loop.
solver is an atribute of my class with all the data inside.
Thanks in advance for your help!