From f9061886cc265d501e3d0cbc51df1d5bb76284f0 Mon Sep 17 00:00:00 2001 From: Bozheng Long Date: Tue, 21 Nov 2023 00:25:11 +0000 Subject: [PATCH] Add files via upload --- Working Documents/plot_headmotion.py | 35 ++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 Working Documents/plot_headmotion.py diff --git a/Working Documents/plot_headmotion.py b/Working Documents/plot_headmotion.py new file mode 100644 index 0000000..8fce4bd --- /dev/null +++ b/Working Documents/plot_headmotion.py @@ -0,0 +1,35 @@ +import matplotlib.pyplot as plt + + +filename = 'rp_filename.txt' +data = [] +with open(filename, 'r') as file: + for line in file: + line = line.strip() + if line: + values = line.split() + data.append([float(value) for value in values]) + + +x = [row[0] for row in data] +y = [row[1] for row in data] +z = [row[2] for row in data] +rotation_x = [row[3] for row in data] +rotation_y = [row[4] for row in data] +rotation_z = [row[5] for row in data] + + +plt.figure(figsize=(10, 6)) +plt.plot(x, label='X') +plt.plot(y, label='Y') +plt.plot(z, label='Z') +plt.plot(rotation_x, label='Rotation X') +plt.plot(rotation_y, label='Rotation Y') +plt.plot(rotation_z, label='Rotation Z') +plt.xlabel('Time point') +plt.ylabel('mm/deg') +plt.title('Head motion') +plt.legend() +plt.ylim(-0.6, 0.4) +plt.grid(True) +plt.show()