Matplotlib very slow

OK, the delay comes before draw which is an important piece of
information. What happens if you run these two scripts. Do you get
the delay?

# script 1 (no plot)
from pylab import *

No delay. Debug output stops at line "backend GTKAgg version 2.10.1", but
returns to prompt. I'd say this works as expected.

# script2 (no show)
from pylab import *
plot([1,2,3])

Delay. Delay on the same bit I commented on before (see the previous debug
output). So no need to wait for the show() call to get to the error, I
guess...

Thanks

···

On Tuesday 04 December 2007 15:13:21 you wrote:

What about these scripts

# just make a figure
from pylab import *
figure()

# just make a subplot
from pylab import *
subplot(111)

I'm trying to narrow down where the problem is occurring and am still
stumped as to the explanation...

···

On Dec 4, 2007 9:19 AM, José Gómez-Dans <jgomezdans@...287...> wrote:

On Tuesday 04 December 2007 15:13:21 you wrote:
> OK, the delay comes before draw which is an important piece of
> information. What happens if you run these two scripts. Do you get
> the delay?
>
> # script 1 (no plot)
> from pylab import *

No delay. Debug output stops at line "backend GTKAgg version 2.10.1", but
returns to prompt. I'd say this works as expected.

> # script2 (no show)
> from pylab import *
> plot([1,2,3])

What about these scripts

# just make a figure
from pylab import *
figure()

Takes a long time.

# just make a subplot
from pylab import *
subplot(111)

Takes a long time.

I'm trying to narrow down where the problem is occurring and am still
stumped as to the explanation...

I've used MPL in a few system, and it is only on this particular one that it
has this delay! Incidentally, do you want the debug output from these two
scripts? They essentially the same as the ones I sent before (up to backend
GTKAgg version 2.10.1, where the output stops, and after a while, we're back
at the command line).

Thanks,
J

···

On Tuesday 04 December 2007 15:31:04 John Hunter wrote:

OK, it is in the gtk figure creation code. Get the matplotlib
examples directory and try running examples/embedding_in_gtk.py which
does not use pylab but instead does all the gtk stuff manually. See
if you can reproduce the error. If so, slowly remove or comment out
parts of the code until you get the minimal script which reproduces
the slowness and then send it my way with commentary. It looks like
you may have something wrong with your gtk installation but it is hard
to say.

JDH

···

On Dec 4, 2007 9:39 AM, José Gómez-Dans <jgomezdans@...287...> wrote:

On Tuesday 04 December 2007 15:31:04 John Hunter wrote:
> What about these scripts
>
> # just make a figure
> from pylab import *
> figure()

Takes a long time.

Interestingly enough, the embedding_in_gtk.py script works perfectly (takes
less than a second to run), so I am not able to reproduce the slowness!

Thanks!

···

On Tuesday 04 December 2007 15:54:17 you wrote:

OK, it is in the gtk figure creation code. Get the matplotlib
examples directory and try running examples/embedding_in_gtk.py which
does not use pylab but instead does all the gtk stuff manually. See
if you can reproduce the error. If so, slowly remove or comment out
parts of the code until you get the minimal script which reproduces
the slowness and then send it my way with commentary. It looks like
you may have something wrong with your gtk installation but it is hard
to say.

Hmm, the plot thickens. How about embedding_in_gtk2.py -- this add the toolbar

JDH

···

On Dec 4, 2007 10:00 AM, José Gómez-Dans <jgomezdans@...287...> wrote:

Interestingly enough, the embedding_in_gtk.py script works perfectly (takes
less than a second to run), so I am not able to reproduce the slowness!

This does indeed slow things down. The minimal script that reproduces this
behaviour is the following (the delay appears round about the definition of
toolbar):

import gtk
from matplotlib.axes import Subplot
from matplotlib.figure import Figure
from numpy import arange, sin, pi
from matplotlib.backends.backend_gtk import FigureCanvasGTK as FigureCanvas
from matplotlib.backends.backend_gtk import NavigationToolbar2GTK \
  as NavigationToolbar
win = gtk.Window()
win.connect("destroy", lambda x: gtk.main_quit())
win.set_default_size(400,300)
win.set_title("Embedding in GTK")
fig = Figure(figsize=(5,4), dpi=100)
canvas = FigureCanvas(fig)
toolbar = NavigationToolbar(canvas, win)
# ^ Delay appears here
win.add(toolbar)
win.show_all()
gtk.main()

···

On Tuesday 04 December 2007 16:05:33 John Hunter wrote:

On Dec 4, 2007 10:00 AM, José Gómez-Dans <jgomezdans@...287...> wrote:
> Interestingly enough, the embedding_in_gtk.py script works perfectly
> (takes less than a second to run), so I am not able to reproduce the
> slowness!

Hmm, the plot thickens. How about embedding_in_gtk2.py -- this add the
toolbar

[...]

Mmmm... I was just wondering whether compiling the new 0.91.1 version might
make the problem go away? I am currently running 0.90.1.

Thanks,
J

···

On Tuesday 04 December 2007 16:16:06 José Gómez-Dans wrote:

On Tuesday 04 December 2007 16:05:33 John Hunter wrote:
> On Dec 4, 2007 10:00 AM, José Gómez-Dans <jgomezdans@...287...> wrote:
> Hmm, the plot thickens. How about embedding_in_gtk2.py -- this add the
> toolbar

This does indeed slow things down. The minimal script that reproduces this
behaviour is the following (the delay appears round about the definition of
toolbar):

Unlikely, we haven't changed anything in that code. One thing you can
do, it is fairly labor intensive, is to paste the toolbar code from
backend_gtk into your script and slowly start hacking away at it to
see which gtk call is causing your problems. I don't see an easier
way.

Alternatively, you could get tkagg, qtagg or wxagg installed. If you
want to stick with gtk, I can provide a sample script for you that
defines the toolbar inline so you can hack on it.

JDH

···

On Dec 5, 2007 8:58 AM, José Gómez-Dans <jgomezdans@...287...> wrote:

Mmmm... I was just wondering whether compiling the new 0.91.1 version might
make the problem go away? I am currently running 0.90.1.