diff python/indicators.py @ 265:7a3bf04cf016

added plotting of indicators
author Nicolas Saunier <nicolas.saunier@polymtl.ca>
date Thu, 26 Jul 2012 19:46:36 -0400
parents 8f0ed138d373
children a9988971aac8
line wrap: on
line diff
--- a/python/indicators.py	Thu Jul 26 03:54:41 2012 -0400
+++ b/python/indicators.py	Thu Jul 26 19:46:36 2012 -0400
@@ -75,6 +75,14 @@
         else: 
             return values
 
+    def plot(self, options = '', **kwargs):
+        from matplotlib.pylab import plot
+        if not self.timeInterval and type(self.values)==dict:
+            time = sorted(self.values.keys())
+            plot(time, [self.values[i] for i in time], options, **kwargs)
+        else:
+            plot(list(getTimeInterval()), self.values, options, **kwargs)
+
 class SeverityIndicator(TemporalIndicator):
     '''Class for severity indicators 
     field mostSevereIsMax is True