matplotlib basic question

cfriedalek at gmail.com cfriedalek at gmail.com
Thu Apr 19 19:13:43 EDT 2007


> 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.
This may not be strictly correct but  thats a reference to the plot
instance which is subsequently passed to show().
If you don't want to see it put a semicolon at the end of your command
eg. plot(range(5));

The issue with IDLE is to due with lack of connection between the
python interpreter event loop and the event loop of matplotlib (I
think). For me the solution was to install the ipython shell (http://
ipython.scipy.org/moin/). If you run ipython with the -pylab flag then
you can matplotlib interactively. For example

plot(range(5),'bo')
show()
clf()
plot([1,2,3,4,5],range(0,10,2),'r-')
(no need for another show() command since the graphics display is
already visible ... unless of course I deleted it in between plot
commands)

hth





More information about the Python-list mailing list