-
Notifications
You must be signed in to change notification settings - Fork 0
/
plotter.py
36 lines (32 loc) · 963 Bytes
/
plotter.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
import matplotlib.pyplot as plt
import csv
import time
while(1):
time.sleep(20)
plt.rcParams["figure.figsize"] = [20, 10]
plt.rcParams["figure.autolayout"] = True
fig = plt.figure()
x = []
y = []
with open('Power_State.csv','r') as csvfile:
lines = csv.reader(csvfile, delimiter=',')
for count,row in enumerate(reversed(list(lines))):
if(count==0):
continue
if(count>20):
break
x.append(row[1])
y.append(int(row[0]))
x.reverse()
y.reverse()
plt.plot(x, y, color = 'g', linestyle = 'dashed',
marker = 'o',label = "Power State Variation")
plt.xticks(rotation =25)
plt.xlabel('Time')
plt.ylabel('Power State')
plt.title('Led Strip Power State', fontsize = 20)
plt.grid()
plt.legend()
fig.subplots_adjust(bottom=0.3)
print('plot saved.\n')
plt.savefig('Power.png')