-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpendel_graf.py
More file actions
38 lines (28 loc) · 1002 Bytes
/
pendel_graf.py
File metadata and controls
38 lines (28 loc) · 1002 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import pandas as pd
import matplotlib.pyplot as plt
import os
# Get the current working directory
current_directory = os.getcwd()
# Specify the directory containing the CSV files
data_folder = os.path.join(current_directory, 'recorded_data')
# List all CSV files in the directory
csv_files = [f for f in os.listdir(data_folder) if f.endswith('.csv')]
# Loop through each CSV file
for csv_file in csv_files:
# Construct the full file path
file_path = os.path.join(data_folder, csv_file)
# Read the CSV file into a DataFrame
df = pd.read_csv(file_path)
# Extract the 'Position_X' and 'Time (s)' columns
position_x = df['Vinkel']
time = df['Time (s)']
# Create a scatter plot
plt.scatter(time, position_x)
# Create a scatter of vinkel_hastighet
#plt.scatter(time, df['Vinkel_hastighet'])
# Set labels and title
plt.xlabel('Tid (s)')
plt.ylabel('Vinkel')
plt.title(f'Vinkel over tid for: {csv_file}')
# Show the plot
plt.show()