有类似的问题here但我没有相同的问题。下面是我的数据集的快照:Matplotlib动画显示为空
从本质上讲,我想动画随着时间的落客坐标。正如你所看到的日期排序dropoff_datetime
。这是我的代码(非常类似于上面的问题)。
fig = plt.figure(figsize=(10,10))
ax = plt.axes(xlim=xlim, ylim=ylim)
points, = ax.plot([], [],'.',alpha = 0.4, markersize = 0.05)
def init():
points.set_data([], [])
return points,
# animation function. This is called sequentially
def animate(i):
x = test["dropoff_longitude"]
y = test["dropoff_latitude"]
points.set_data(x, y)
return points,
anim = animation.FuncAnimation(fig, animate, init_func=init,
frames=100, interval=20, blit=True)
plt.show()
与上面链接的问题类似,我的情节只是显示为空。我相信我正确地编码它,不同于上面的链接,我确实看到了坐标在不断变化。我不知道为什么情节是空的。
_I确实看到了那个坐标切换time_:听起来好像是你所期待的。 _我不确定问题是什么:如果你没有描述你的问题,我们也不知道。 – pingul
对不起,我认为我参考上面的链接会清除那个。我更新了我的帖子。即使一切看起来都设置得当,我的情节是空的。 – madsthaks