Re: [Matplotlib-users] Specifying X,Y Pairs For Line Plots

2007-11-26 Thread Rich Shepard
On Mon, 26 Nov 2007, Christopher Barker wrote: > or better yet -- work with numpy arrays from the beginning: Chris, These values are retrieved from widgets on a notebook page and the plot will be used to display them on that tab. It would take more code to convert those values to a numpy arra

Re: [Matplotlib-users] Specifying X,Y Pairs For Line Plots

2007-11-26 Thread Christopher Barker
Rich Shepard wrote: >> x,y = zip(*[(15.0, 0.0), (30.0, 1.0), (70.0, 1.0), (85.0, 0.0)]) or better yet -- work with numpy arrays from the beginning: Either put x an y into separate arrays (which is what MPL expects), or if you like X and Y begin together (I do): points = numpy.array([(15.0, 0.0)

Re: [Matplotlib-users] Specifying X,Y Pairs For Line Plots

2007-11-25 Thread Rich Shepard
On Sun, 25 Nov 2007, Jouni K Seppänen wrote: x,y = zip(*[(15.0, 0.0), (30.0, 1.0), (70.0, 1.0), (85.0, 0.0)]) Jouni, Thank you for pointing this out to me. I see that it's a builtin function similar to map that assembles the first element of each tuple into a list for the first variable, an

Re: [Matplotlib-users] Specifying X,Y Pairs For Line Plots

2007-11-25 Thread Rich Shepard
On Sun, 25 Nov 2007, Jouni K Seppänen wrote: You are looking for the classic "unzip" trick: x,y = zip(*[(15.0, 0.0), (30.0, 1.0), (70.0, 1.0), (85.0, 0.0)]) Jouni, That's totally new to me. I'll go find out what it is and how it works its magic. Thank you, Rich -- Richard B. Shepard, Ph.

Re: [Matplotlib-users] Specifying X,Y Pairs For Line Plots

2007-11-25 Thread Jouni K Seppänen
Rich Shepard <[EMAIL PROTECTED]> writes: > x,y = [(15.0, 0.0), (30.0, 1.0), (70.0, 1.0), (85.0, 0.0)] > ValueError: too many values to unpack You are looking for the classic "unzip" trick: x,y = zip(*[(15.0, 0.0), (30.0, 1.0), (70.0, 1.0), (85.0, 0.0)]) -- Jouni ---

Re: [Matplotlib-users] Specifying X,Y Pairs For Line Plots

2007-11-25 Thread Rich Shepard
On Sun, 25 Nov 2007, Darren Dale wrote: > you need a "," after that "(70,1.0)" Thanks, Darren. Not enough caffine, I guess. However, now I get: Traceback (most recent call last): File "trapezoid.py", line 4, in ? x,y = [(15.0, 0.0), (30.0, 1.0), (70.0, 1.0), (85.0, 0.0)] ValueErro

Re: [Matplotlib-users] Specifying X,Y Pairs For Line Plots

2007-11-25 Thread Darren Dale
On Sunday 25 November 2007 12:15:54 pm Rich Shepard wrote: > x,y = [(15,0.0), (30,1.0), (70,1.0) (85,0.0)] you need a "," after that "(70,1.0)" - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R)

[Matplotlib-users] Specifying X,Y Pairs For Line Plots

2007-11-25 Thread Rich Shepard
I need to plot trapezoids as well as left- and right-shouldered straight line plots. If I specify separate lists for the x values and their corresponding y values, the plots are generated and displayed as needed. However, I cannot specify the points as a list of tuples and have matplotlib accept