1 year ago

#224112

test-img

Ali11H

scattering a set of 3d points over time

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()

python

matplotlib

matplotlib-animation

matplotlib-3d

scatter3d

0 Answers

Your Answer

Accepted video resources