On Mon, Apr 27, 2009 at 2:28 PM, keflavich <keflavich@gmail.com> wrote:


John Hunter-4 wrote:
>
> That does sound exceedingly slow -- it looks like you are having some
> problems with the GUI or environment and not just the mpl component.  How
> are you running and profiling your script?  Can you post some
> free-standing
> example code which exposes the problem?  Can you provide some of the
> environment data detailed at
> http://matplotlib.sourceforge.net/faq/troubleshooting_faq.html#reporting-problems
>

I haven't been doing any profiling; I've never been particularly comfortable
with timeit.

As for normal problem reporting details...
Darwin eta.colorado.edu 9.6.3 Darwin Kernel Version 9.6.3: Tue Jan 20
18:26:40 PST 2009; root:xnu-1228.10.33~1/RELEASE_I386 i386 i386
matplotlib version 0.98.3


My example standalone script (note that it takes the backend as a command
line argument and assumes you have not selected a backend / imported pylab):

import matplotlib
import sys
matplotlib.use(sys.argv[1])
from pylab import *

i=1; n=1;
print "Working on figure 0"
figure(0); clf()
for j in xrange(36):
   if (i % 10)==0:
       print "Working on figure %i" % n
       figure(n); clf()
       i=1
       n+=1
   subplot(3,3,i)
   plot([1,2,3],[3,2,1])
   plot([1,2,1],[1,2,3])
   plot([1,2,3],[1,2,3])
   i+=1


Results:

In [1]: %run -t code/test.py 'Qt4Agg'


Ahh, mixing matplotlib.use from an interactive ipython session -- that is an important detail :-)  What is your backend (import matplotlib; print matplotlib.rcParams['backend'])   It is quite likely that you are getting cross GUI / cross threading problems from trying to do this inside ipython, which may be using one GUI backend based on rc at pylab startup, and mpl is trying to use another one with the use directive.  Basically, "use" is not supported for switching GUIs, it was designed to be the first line executed in a session but when you do this interactively in ipython pylab mode, you are asking for a world of pain.

Try running your example from a standard unix shell rather than from ipython

JDH