-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathpyDis.py
executable file
·40 lines (36 loc) · 928 Bytes
/
pyDis.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
#!/usr/bin/env python
import math
# import matplotlib
# matplotlib.use('Qt5Agg')
import matplotlib.pyplot as pl
from matplotlib import gridspec
import numpy as np
import csv
import sys
time = []
data = []
labels = set()
with open(sys.argv[1], 'r') as csvFile:
reader = csv.DictReader(csvFile)
labels = reader.fieldnames
data.append([])
for row in reader:
time.append(float(row[labels[0]]))
for var in range(1,len(labels)):
data.append([])
data[var].append(float(row[labels[var]]))
csvFile.close()
N = len(labels) - 1
cols = int(math.ceil(N / 4))
rows = int(math.ceil(N / cols))
gs = gridspec.GridSpec(rows, cols)
fig = pl.figure()
for var in range(1,len(labels)):
ax = fig.add_subplot(gs[var - 1])
ax.plot(time, data[var])
ax.set_title(labels[var])
ax.set_xlabel(labels[0])
# ax.set_ylabel(labels[var])
fig.set_tight_layout(True)
fig.show()
input()