diff agl.py @ 11:9fac3371e9ad

Print consumption and generation, tTwiddle text box, remove debugging.
author Daniel O'Connor <darius@dons.net.au>
date Mon, 11 Sep 2017 18:07:16 +0930
parents 70cc1e874157
children b610ce4ec081
line wrap: on
line diff
--- a/agl.py	Mon Sep 11 17:57:38 2017 +0930
+++ b/agl.py	Mon Sep 11 18:07:16 2017 +0930
@@ -143,6 +143,8 @@
 tarrifs = {
     'power_exported' : 0.163,
     'power_imported' : 0.380,
+    'power_generated' : 0.163,
+    'power_consumed' : 0.380,
 }
 
 names = {
@@ -227,7 +229,6 @@
 
         if col in tarrifs:
             annotation = '%s: $%.2f' % (names[col], (ydata[1:] * xdeltas).sum() / 1000.0 * tarrifs[col])
-            print(annotation)
         else:
             annotation = None
 
@@ -269,8 +270,9 @@
                 annotations.append(line[6])
 
         ax2.legend(loc = 'upper right')
-    ax1.text(0.02, 0.8, reduce(lambda a, b: a + '\n' + b, annotations),
-                 transform = ax1.transAxes, bbox=dict(facecolor='red', alpha=0.5))
+    ax1.text(0.02, 0.9, reduce(lambda a, b: a + '\n' + b, annotations),
+                 transform = ax1.transAxes, bbox = dict(facecolor = 'red', alpha = 0.5),
+                 ha = 'left', va = 'top')
     ndays = int(max(1, round(((end - start).total_seconds()) / 86400)))
     for ax in fig.get_axes():
         ax.set_title('%s to %s' % (start.strftime('%Y-%m-%d'), end.strftime('%Y-%m-%d')))