[Matplotlib-users] How to do accumulation plots with matplotlib

2009-09-05 Thread nbv4

Hi, I am a new user to matplotlib. I have a huge list of values that look
like this:

[1,0,0,0,2,3,2,1,0,0,0,2,2,1,3,0,0,3...]

each point basically represents the derivative of the line at that point, if
that makes any sense. 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,...]

...so the line grows as the numbers get bigger. Is there a plot that takes
data in the form of my first list, or is my only option to create a forloop
and construct the second list manually and just use that?

It seems the target audience for matplotlib is scientific people who know a
lot about math and statistics, which I am not. A lot of the documentation
just goes over my head.
-- 
View this message in context: 
http://www.nabble.com/How-to-do-accumulation-plots-with-matplotlib-tp25304056p25304056.html
Sent from the matplotlib - users mailing list archive at Nabble.com.


--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] How to do accumulation plots with matplotlib

2009-09-05 Thread Jouni K . Seppänen
nbv4 cp368...@ohiou.edu 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


--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] How to do accumulation plots with matplotlib

2009-09-05 Thread nbv4



Jouni K. Seppänen wrote:
 
 nbv4 cp368...@ohiou.edu 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
 
 
 --
 Let Crystal Reports handle the reporting - Free Crystal Reports 2008
 30-Day 
 trial. Simplify your report design, integration and deployment - and focus
 on 
 what you do best, core application coding. Discover what's new with 
 Crystal Reports now.  http://p.sf.net/sfu/bobj-july
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users
 
 
Thats exactly it, thanks!
-- 
View this message in context: 
http://www.nabble.com/How-to-do-accumulation-plots-with-matplotlib-tp25304056p25313944.html
Sent from the matplotlib - users mailing list archive at Nabble.com.


--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users