Coding Global Background
Coding Global

I want a 3d animation but the plot is not showing any points

Archiviert a year ago
6 Nachrichten
0 Mitglieder
a year ago
In Discord öffnen
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() ```

Antworten (6)