matplotlib basic question

orangeDinosaur trevis.crane at gmail.com
Thu Apr 19 16:58:47 EDT 2007


Hi,

I am exploring the possibility of using python as a replacement of
MATLAB when I leave school.  So, I've been playing with matplotlib and
have run into some weird behavior after recently installing python
2.5.1 and matplotlib 0.90 on my Windows XP machine. Here's an example
of what I see:

>>>from matplotlib.pylab import *
>>>x=arange(-2*pi,2*pi,pi/24)
>>>y=sin(x)
>>>plot(x,y)
[<matplotlib.lines.Line2D instance at 0x017C38C8>]
>>> show()


So, first off, what's up with the [<matplotlib.lines.Line2D instance
at 0x017C38C8>] line that shows up after my plot command?  And second,
when I call show(), a new figure pops up with my sin wave -- seems all
right, yes? But I'm not given another >>> prompt in IDLE until or
unless I close the figure that popped up with the show() call.

So, after closing the figure I type this:

>>>show()
>>>plot(x,y)
>>>

and this time another figure pops up with my sine wave again and I get
a prompt as well.  But now, the figure window is completely
unresponsive -- I can't even close it without getting the "your
program is not repsonding" business.  What am I missing?  This
behavior so far seems pretty unintuitive.

Any clarification is appreciated!

trevis




More information about the Python-list mailing list