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

[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

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)

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)] ValueError: too

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, 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,