From f3a73425242f076c063ced98b69144a267753c4a Mon Sep 17 00:00:00 2001 From: Orestis <orestis.malaspinas@pm.me> Date: Mon, 3 Oct 2022 10:08:15 +0200 Subject: [PATCH] added legend to numpy scritp --- experiment/newton/newton.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/experiment/newton/newton.py b/experiment/newton/newton.py index 79538f8..bd11c68 100644 --- a/experiment/newton/newton.py +++ b/experiment/newton/newton.py @@ -1,4 +1,5 @@ import numpy as np +import matplotlib.pyplot as plt time_pos = np.genfromtxt("input.txt", delimiter=",") @@ -16,3 +17,8 @@ vel_p1 = np.roll(vel, -1) acc = (vel_p1 - vel) / (time_p1 - time) # print(np.mean(acc[0:len(acc)-2])) +plt.plot(time[0:len(pos)], pos, label='position') +plt.plot(time[0:len(vel)-1], vel[0:len(vel)-1], label='velocity') +plt.plot(time[0:len(acc)-2], acc[0:len(acc)-2], label='acceleration') +plt.legend() +plt.show() -- GitLab