随着时间的推移分散一组 3d 点
我有一个以下类别的数据集:
class Event:
def __init__(self, timestamp, lx, ly, lz, nature):
try:
self.timestamp = datetime.strptime(timestamp, "%d/%m/%Y %H:%M")
except:
self.timestamp = datetime.strptime(timestamp, "%d/%m/%Y %H:%M:%S")
self.x = lx
self.y = ly
self.z = lz
self.nature = nature
问题是我正在尝试在 3d 中对这些点随时间的散布进行动画处理,其中我将指定 delta t 并从 t0 开始迭代直到 t max ,其中每一步都会有新的散点是在间隔增量中具有 t 的点。
这是我设法做的顺序:
def animation_tremor_events(index_Event):
dx, dy, dz = arr_s_t_points[index_Event, 0], arr_s_t_points[index_Event, 1], arr_s_t_points[index_Event, 2]
print(dx, dy, dz)
text.set_text("{:d}: [{:.0f},{:.0f},{:.0f}]".format(index_Event, dx, dy, dz)) # for debugging
x.append(dx)
y.append(dy)
z.append(dz)
graph._offsets3d = (x, y, z)
return graph,
这些是重要的部分,因为代码太长
ani = animation.FuncAnimation(fig, animation_tremor_events, frames=600, interval=0.001, save_count=5000)
plt.show()
I have a data set of the following class:
class Event:
def __init__(self, timestamp, lx, ly, lz, nature):
try:
self.timestamp = datetime.strptime(timestamp, "%d/%m/%Y %H:%M")
except:
self.timestamp = datetime.strptime(timestamp, "%d/%m/%Y %H:%M:%S")
self.x = lx
self.y = ly
self.z = lz
self.nature = nature
the thing is I am trying to animate a scatter of these points over time in 3d where I would specify a delta t and starting from t0 I would iterate till t max where at each step the new scattered points are the ones that have t in the increment to the interval.
this is the sequential one I manged to do:
def animation_tremor_events(index_Event):
dx, dy, dz = arr_s_t_points[index_Event, 0], arr_s_t_points[index_Event, 1], arr_s_t_points[index_Event, 2]
print(dx, dy, dz)
text.set_text("{:d}: [{:.0f},{:.0f},{:.0f}]".format(index_Event, dx, dy, dz)) # for debugging
x.append(dx)
y.append(dy)
z.append(dz)
graph._offsets3d = (x, y, z)
return graph,
these are the important segments because the code is too long
ani = animation.FuncAnimation(fig, animation_tremor_events, frames=600, interval=0.001, save_count=5000)
plt.show()
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论