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