nbv4 <cp3...@oh...> writes:
> [1,0,0,0,2,3,2,1,0,0,0,2,2,1,3,0,0,3...]
>
> [...] I want to take this data and display it in a linegraph
> as if it were this data:
>
> [1,1,1,1,3,5,7,8,8,8,10,12,13,16,16,16,19,...]
You can use numpy.cumsum to transform your data. For example, in ipython
-pylab:
In [4]: x = [1,0,0,0,2,3,2,1,0,0,0,2,2,1,3,0,0,3]
In [5]: cumsum(x)
Out[5]:
array([ 1, 1, 1, 1, 3, 6, 8, 9, 9, 9, 9, 11, 13, 14, 17, 17, 17,
20])
In [6]: plot(cumsum(x))
Out[6]: [<matplotlib.lines.Line2D object at 0xa945070>]
--
Jouni K. Seppänen
http://www.iki.fi/jks
|