-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplot.py
More file actions
42 lines (32 loc) · 879 Bytes
/
Copy pathplot.py
File metadata and controls
42 lines (32 loc) · 879 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
39
40
41
import csv
agents = {}
with open('results') as f:
rows = csv.reader(f)
for row in rows:
agent, certainty = row
if agent in agents :
agents[agent].append(certainty)
else:
agents[agent] = [certainty]
maxlen = 0
for agent in agents:
# print (agent, len(agents[agent]))
if len(agents[agent]) > maxlen :
maxlen = len(agents[agent])
for agent in agents:
for i in range(maxlen - len(agents[agent])):
agents[agent].append(agents[agent][-1])
for agent in agents:
print (agent, len(agents[agent]))
import matplotlib.pyplot as plt
t = range(maxlen)
for agent in agents:
s = agents[agent]
plt.plot(t, s, label=agent)
plt.xlabel('Time Steps')
plt.ylabel('Certainty')
plt.title('12 Angry Agents')
plt.grid(True)
plt.savefig("test.png")
plt.legend( loc='lower right')
plt.show()