import numpy as np
import matplotlib.pyplot as plt

# Read data from the text file, ignoring the first and last rows
data = np.loadtxt('organized_data_up_neg.txt', skiprows=1, usecols=(0, 1, 2), delimiter=' ')

# Extract data for each column
column1 = data[:, 0]
column2 = data[:, 1]
column3 = data[:, 2]
print(column1);
print(column2);
print(column3);
# Plot the data
plt.figure(figsize=(10, 6))
plt.plot(column1, label='X')
plt.plot(column2, label='Y')
plt.plot(column3, label='Z')
plt.xlabel('accelaration')
plt.ylabel('sample')
plt.title('Accelaration plot for UP')
plt.legend()
plt.grid(True)
#plt.show()

data = np.loadtxt('organized_data_down_neg.txt', skiprows=1, usecols=(0, 1, 2), delimiter=' ')

# Extract data for each column
column1 = data[:, 0]
column2 = data[:, 1]
column3 = data[:, 2]

print(column1);
print(column2);
print(column3);
# Plot the data
plt.figure(figsize=(10, 6))
plt.plot(column1, label='X')
plt.plot(column2, label='Y')
plt.plot(column3, label='Z')
plt.xlabel('accelaration')
plt.ylabel('sample')
plt.title('Accelaration plot for Down')
plt.legend()
plt.grid(True)
#plt.show()


data = np.loadtxt('organized_data_right_neg.txt', skiprows=1, usecols=(0, 1, 2), delimiter=' ')

# Extract data for each column
column1 = data[:, 0]
column2 = data[:, 1]
column3 = data[:, 2]


print(column1);
print(column2);
print(column3);
# Plot the data
plt.figure(figsize=(10, 6))
plt.plot(column1, label='X')
plt.plot(column2, label='Y')
plt.plot(column3, label='Z')
plt.xlabel('accelaration')
plt.ylabel('sample')
plt.title('Accelaration plot for  Right')
plt.legend()
plt.grid(True)
#plt.show()


data = np.loadtxt('organized_data_left_neg.txt', skiprows=1, usecols=(0, 1, 2), delimiter=' ')

# Extract data for each column
column1 = data[:, 0]
column2 = data[:, 1]
column3 = data[:, 2]

print(column1);
print(column2);
print(column3);
# Plot the data
plt.figure(figsize=(10, 6))
plt.plot(column1, label='X')
plt.plot(column2, label='Y')
plt.plot(column3, label='Z')
plt.xlabel('accelaration')
plt.ylabel('sample')
plt.title('Accelaration plot for  Left')
plt.legend()
plt.grid(True)
data = np.loadtxt('organized_data_rest_neg.txt', skiprows=1, usecols=(0, 1, 2), delimiter=' ')

column1 = data[:, 0]
column2 = data[:, 1]
column3 = data[:, 2]

print(column1);
print(column2);
print(column3);
# Plot the data
plt.figure(figsize=(10, 6))
plt.plot(column1, label='X')
plt.plot(column2, label='Y')
plt.plot(column3, label='Z')
plt.xlabel('accelaration')
plt.ylabel('sample')
plt.title('Accelaration plot for  rest')
plt.legend()
plt.grid(True)

plt.show()
