1

i got this code:

 while cap.isOpened():

    pose = results.pose_landmarks.landmark
    pose_row_x = list(np.array([[landmark.x] for landmark in pose]).flatten())
    pose_row_y = list(np.array([[landmark.y] for landmark in pose]).flatten())
    pose_row_z = list(np.array([[landmark.z] for landmark in pose]).flatten())

    df = pd.DataFrame(data=[pose_row_x, pose_row_y, pose_row_z ]).T
    df.columns = ["x", "y", "z"]
  


    plt.scatter(df['x'],df['y'])
    plt.plot()

I would like to print the new added values in "real Time" in the same plot. For every loop i got a new plot.

Is there any way to update the plot in every loop iteration ?

EDIT: PLOT: enter image description here I would be grateful for any help!

1 Answer 1

2

I would recommend using a single Axes object for all of your plots. Something like this:

fig, ax = plt.subplots()

while cap.isOpened():

    # generate data here

    ax.scatter(df['x'], df['y'])
Sign up to request clarification or add additional context in comments.

2 Comments

Thanks for your reply! The Plot i got is shown in the original post. I would like to see something lik an animation of the data. Is there any way to get this ? :)
Yeah I believe you can call ax.clear() right before ax.scatter() each iteration. That should do it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.