-
Notifications
You must be signed in to change notification settings - Fork 0
/
plot.py
58 lines (46 loc) · 1.56 KB
/
plot.py
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
import csv
import matplotlib.pyplot as plt
def read_csv_data(file_path):
steps = []
values = []
with open(file_path, 'r') as csvfile:
reader = csv.DictReader(csvfile)
for row in reader:
steps.append(int(row['Step']))
values.append(float(row['Value']))
return steps, values
parallel_59 = 'analysis/parallel_59_ppo_1_loss.csv'
parallel_63 = 'analysis/parallel_63_ppo_1_loss.csv'
perpen_19 = 'analysis/perpen_19_ppo_1_loss.csv'
perpen_24 = 'analysis/perpen_24_ppo_1_loss.csv'
steps_59, values_59 = read_csv_data(parallel_59)
steps_63, values_63 = read_csv_data(parallel_63)
steps_19, values_19 = read_csv_data(perpen_19)
steps_24, values_24 = read_csv_data(perpen_24)
# Parallel Parking
plt.figure()
plt.plot(steps_59, values_59, label='Good Case')
plt.plot(steps_63, values_63, label='Base Case')
plt.xlabel('Steps')
plt.ylabel('Loss')
plt.title('Loss vs. Steps (Parallel Parking)')
plt.grid(True)
plt.legend()
plt.xlim(min(steps_59), 150000)
tick_locations = list(range(0, 150000 + 25000, 25000))
tick_labels = [str(tick) for tick in tick_locations]
plt.xticks(tick_locations, tick_labels)
# Perpendicular Parking
plt.figure()
plt.plot(steps_19, values_19, label='Good Case')
plt.plot(steps_24, values_24, label='Base Case')
plt.xlabel('Steps')
plt.ylabel('Loss')
plt.title('Loss vs. Steps (Perpendicular Parking)')
plt.grid(True)
plt.legend()
plt.xlim(min(steps_19), 100000)
tick_locations = list(range(0, 100000 + 25000, 25000))
tick_labels = [str(tick) for tick in tick_locations]
plt.xticks(tick_locations, tick_labels)
plt.show()