Interactive backends very (suprisingly?) slow for multiple subplots

Thanks John. I think you answered my questions completely now.

FWIW, I was not using matplotlib.use() with ipython, I was using it
when calling 'python test.py' on the command line. My mistake with
ipython was using an import command before -pylab, i.e.:
ipython -i -c "import pyfits,matplotlib" -pylab

which does not work, whereas
ipython -pylab -i -c "import pyfits,matplotlib"

does.

Thanks for the help!

···

On Wed, Apr 29, 2009 at 9:22 AM, John Hunter <jdh2358@...287...> wrote:

On Wed, Apr 29, 2009 at 9:50 AM, Adam <keflavich@...287...> wrote:

I would like to have access to the command line while simultaneously
being able to interact with and/or display plots. I think this is
what ipython does by default when you pass it a thread keyword
(-pylab, -qt4thread, etc.). I had some trouble getting ipython to
work correctly, but I think that had to do with passing the thread
keyword before/after some other keywords.

From your previous posts, I think you may have been be using ipython
incorrectly, ie mixing ipython -pylab with the matplotlib use directive.
Start with a canconical simple script, eg::

import matplotlib\.pyplot as plt

plt\.figure\(1\)
plt\.plot\(\[1,2,3\]\)

plt\.figure\(2\)
plt\.plot\(\[4,5,6\]\)

plt\.show\(\)

and set your matplotlibrc to backend to TkAgg. Start ipython with::

> ipython -pylab

and run your test script with::

In [61]: run test.py

If that works, close everything down and set your backend to QtAgg and try
running it again in the same way and let us know what happens. It should
just work. I'm suspecting in that as you were testing and trying a lot of
things, you got yourself into a situation where multiple GUIs were competing
for attention.

Part of my question that I hope makes sense: Is there a way to unblock
the command line without closing the plot window when using an
interactive backend?

Yes, that makes sense, and basically you need to either use TkAgg from a
regular python shell, use ipython in pylab mode with any supported backend,
or use a GUI shell. ipython also has support for embedding in GUI shells.
See also

http://matplotlib.sourceforge.net/users/shell.html

JDH