forked from remzi-arpacidusseau/ostep-projects
-
Notifications
You must be signed in to change notification settings - Fork 0
/
plot.py
38 lines (35 loc) · 726 Bytes
/
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
import matplotlib.pyplot as plt
import pandas as pd
df = pd.read_csv("tests-out/1.out", header=None)
x30 = []
y30 = []
t30 = 0
x20 = []
y20 = []
t20 = 0
x10 = []
y10 = []
t10 = 0
for index, row in df.iterrows():
tickets = int(row[2][9:])
if (tickets == 30):
x30.append(index)
t30 += 1
y30.append(t30)
elif (tickets == 20):
x20.append(index)
t20 += 1
y20.append(t20)
elif (tickets == 10):
x10.append(index)
t10 += 1
y10.append(t10)
# plot
plt.bar(x30, y30)
plt.bar(x20, y20)
plt.bar(x10, y10)
plt.margins(0)
plt.xlabel('time')
plt.ylabel('ticks')
plt.legend(['30 tickets', '20 tickets', '10 tickets'])
plt.savefig('ticks.png', dpi=300)