add plot_mhz19.py
authorgregor herrmann <gregor@toastfreeware.priv.at>
Sun, 25 Oct 2020 01:22:41 +0000 (02:22 +0100)
committergregor herrmann <gregor@toastfreeware.priv.at>
Sun, 25 Oct 2020 01:22:41 +0000 (02:22 +0100)
trivial sketch to plot collected test data.
copied from somewhere, so yeah, the x axis has room for improvement.

plot_mhz19.py [new file with mode: 0755]

diff --git a/plot_mhz19.py b/plot_mhz19.py
new file mode 100755 (executable)
index 0000000..fc3976a
--- /dev/null
@@ -0,0 +1,29 @@
+#!/usr/bin/python3
+
+import csv
+from matplotlib import pyplot as plt
+
+filename = 'log.csv'
+'''
+Time,TS,CO2,Temp
+21:02:02,0,661,24
+21:02:08,5021,657,24
+
+'''
+with open(filename) as f:
+    reader = csv.reader(f)
+    headers = next(reader)
+
+    time = []
+    co2 = []
+    for row in reader:
+        time.append(row[0])
+        co2.append(int(row[2]))
+
+    fig = plt.figure(dpi = 128, figsize = (10,6))
+    plt.plot(co2, c = 'red')
+    plt.title('CO₂', fontsize = 24)
+    plt.xlabel('',fontsize = 16)
+    plt.ylabel('ppm', fontsize = 16)
+    plt.tick_params(axis = 'both', which = 'major', labelsize = 16)
+    plt.show()