Mercurial > hg > nsaunier > traffic-intelligence
comparison python/indicators.py @ 408:365d8dee44f3
last changes for TRB14
| author | Nicolas Saunier <nicolas.saunier@polymtl.ca> |
|---|---|
| date | Tue, 13 Aug 2013 23:36:45 -0400 |
| parents | 6d26dcc7bba0 |
| children | eb8baa080470 |
comparison
equal
deleted
inserted
replaced
| 407:5eeb3b9fb568 | 408:365d8dee44f3 |
|---|---|
| 72 return self.name | 72 return self.name |
| 73 | 73 |
| 74 def getValues(self): | 74 def getValues(self): |
| 75 return [self.__getitem__(t) for t in self.timeInterval] | 75 return [self.__getitem__(t) for t in self.timeInterval] |
| 76 | 76 |
| 77 def plot(self, options = '', xfactor = 1., timeShift = 0, **kwargs): | 77 def plot(self, options = '', xfactor = 1., yfactor = 1., timeShift = 0, **kwargs): |
| 78 from matplotlib.pylab import plot,ylim | 78 from matplotlib.pylab import plot,ylim |
| 79 if self.getTimeInterval().length() == 1: | 79 if self.getTimeInterval().length() == 1: |
| 80 marker = 'o' | 80 marker = 'o' |
| 81 else: | 81 else: |
| 82 marker = '' | 82 marker = '' |
| 83 time = sorted(self.values.keys()) | 83 time = sorted(self.values.keys()) |
| 84 plot([(x+timeShift)/xfactor for x in time], [self.values[i] for i in time], options+marker, **kwargs) | 84 plot([(x+timeShift)/xfactor for x in time], [self.values[i]/yfactor for i in time], options+marker, **kwargs) |
| 85 if self.maxValue: | 85 if self.maxValue: |
| 86 ylim(ymax = self.maxValue) | 86 ylim(ymax = self.maxValue) |
| 87 | 87 |
| 88 def valueSorted(self): | 88 def valueSorted(self): |
| 89 ''' return the values after sort the keys in the indicator | 89 ''' return the values after sort the keys in the indicator |
