-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgraph.py
44 lines (37 loc) · 1.09 KB
/
graph.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
import matplotlib.pyplot as plt
import csv
import os
from numpy import cumsum
views = []
clones = []
t = []
sum_views = []
sum_clones = []
dir = "report"
for file in sorted(os.listdir(dir)):
if file.endswith(".csv"):
with open(os.path.join(dir, file), 'r') as csvfile:
plots = csv.reader(csvfile, delimiter=',')
row1 = next(plots)
row2 = next(plots)
row3 = next(plots)
row4 = next(plots)
row5 = next(plots)
views.append(int(row3[-1]))
clones.append(int(row5[-1]))
t.append(os.path.splitext(file)[0])
fig, ax = plt.subplots(4, sharex=True)
ax[0].plot(t, views, label='Views', color='b')
ax[0].set_title('Views')
ax[0].legend()
ax[1].plot(t, clones, label='Clones', color='#ffa500')
ax[1].set_title('Clones')
ax[1].legend()
ax[2].plot(t, cumsum(views), label='Cumulative Views', color='b')
ax[2].set_title('Cumulative Views')
ax[2].legend()
ax[3].set_title('Cumulative Clones')
ax[3].plot(t, cumsum(clones), label='Cumulative Clones', color='#ffa500')
ax[3].legend()
plt.legend()
plt.show()