Mercurial Hosting > traffic-intelligence
changeset 324:99ca91a46007
minor change
author | Nicolas Saunier <nicolas.saunier@polymtl.ca> |
---|---|
date | Thu, 09 May 2013 04:02:46 +0200 |
parents | efd4dd4665ac |
children | 6c9c7c956926 |
files | python/utils.py |
diffstat | 1 files changed, 5 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/python/utils.py Wed May 08 00:19:28 2013 +0200 +++ b/python/utils.py Thu May 09 04:02:46 2013 +0200 @@ -287,17 +287,18 @@ # plotting section ######################### -def stepPlot(X, firstX, lastX, initialCount = 0): - '''for each value in x, increment by one the initial count +def stepPlot(X, firstX, lastX, initialCount = 0, increment = 1): + '''for each value in X, increment by increment the initial count returns the lists that can be plotted - to obtain a step plot increasing by one for each value in x, from first to last value''' + to obtain a step plot increasing by one for each value in x, from first to last value + firstX and lastX should be respectively smaller and larger than all elements in X''' sortedX = [] counts = [initialCount] for x in sorted(X): sortedX += [x,x] counts.append(counts[-1]) - counts.append(counts[-1]+1) + counts.append(counts[-1]+increment) counts.append(counts[-1]) return [firstX]+sortedX+[lastX], counts