I want a 3d animation but the plot is not showing any points
Archived a year ago
M
Martin
Active!
My code thus far:
```py
import matplotlib.pyplot as plt
from matplotlib.animation import FuncAnimation
fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')
points = [[1,1,1], [5,5,5], [10,10,10], [15,15,15]]
scatter = ax.scatter([], [], [])
ax.set_xlim(-20, 20)
ax.set_ylim(-20, 20)
ax.set_zlim(-20, 20)
def updateFrame(frame):
x_data, y_data, z_data = zip(*points[:frame+1])
scatter._offset3d = (x_data, y_data, z_data)
return scatter,
ani = FuncAnimation(fig, updateFrame, frames=len(points), interval=1000, blit=False)
ax.set_xlabel('x')
ax.set_ylabel('y')
ax.set_zlabel('z')
plt.show()
```
