On Mon, Aug 29, 2011 at 10:26 PM, Trevor J Christensen <
tre...@jcmanagement.net> wrote:

> I have a number of questions, but I'll start with one.  Consider the
> following code:
>
> import matplotlib as mpl
> import matplotlib.pyplot as plt
> import numpy as np
> x = np.arange(1, 6)
> plt.plot(x, x*1.5)
> plt.show()
> s = raw_input('Enter anything to continue:')
> plt.show()
> print 'The end'
>
> Question:  The first plt.show() launches an interactive window.  Control
> returns to the script upon its close.  The second plt.show() does nothing
> that I can see.  Why?
>
> Ubuntu 11.04, Python 2.7.1, Matplotlib 0.99.3
>


That is because closing the figure destroys that object.  If you want full
interactive mode, I suggest updating to v1.0.1 (or the upcoming v1.1.0
release) and use plt.ion().  The show() will trigger the figures to appear,
but control immediately returns to the script.

Interactivity in earlier versions of mpl is a bit more hit-or-miss, so you
can try it out first before updating.  Also note that multiple calls to
plt.show() in earlier versions are not recommended, but are allowed in v1.0
and up.

I hope this helps,
Ben Root
------------------------------------------------------------------------------
Special Offer -- Download ArcSight Logger for FREE!
Finally, a world-class log management solution at an even better 
price-free! And you'll get a free "Love Thy Logs" t-shirt when you
download Logger. Secure your free ArcSight Logger TODAY!
http://p.sf.net/sfu/arcsisghtdev2dev
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to