add temperature plot
authorgregor herrmann <gregor@toastfreeware.priv.at>
Sun, 25 Oct 2020 18:46:33 +0000 (19:46 +0100)
committergregor herrmann <gregor@toastfreeware.priv.at>
Sun, 25 Oct 2020 18:46:33 +0000 (19:46 +0100)
plot_mhz19.py

index 0e68605745d79cfe05f1251ae3f875bb5cc11132..526c975d8f75fe91ec9db698768ee60151c2917c 100755 (executable)
@@ -22,6 +22,7 @@ with open(filename) as f:
 
     time = []
     co2 = []
+    temp = []
     startdate = date(2020, 10, 22)
     for row in reader:
         dt = parsedatetime(row[0], startdate)
@@ -30,10 +31,13 @@ with open(filename) as f:
             dt += timedelta(days=1)
         time.append(dt)
         co2.append(int(row[2]))
+        temp.append(int(row[3]))
 
     plt.plot(time, co2, c = 'red')
     plt.title('CO₂')
     plt.xlabel('time')
     plt.ylabel('ppm')
     plt.tick_params(axis = 'both', which = 'major')
+    plt.gca().twinx()
+    plt.plot(time, temp, c = 'blue')
     plt.show()