Bug when embedding Matplotlib 0.91.2 in PyQt 4.4.2

Hi Pierre,

> First, I would like to congratulate you for your work on Matplotlib. I
> am using Matplotlib widgets in all my current projects, embedded in PyQt
> graphical user interfaces.
>
> As you may know, PyQt 4.4.2 has been released a few days ago.
> And I found out a performance bug when embedding a Matplotlib 0.91.2
> canvas in a PyQt 4.4.2 object: the pan/zoom feature is very slow (with
> PyQt 4.3.3, and the exact same scripts, pan/zoom is real-time).
    
Would it be possible to post some benchmarks, something a little more concrete, like specifically what calls are taking the most time, and how they compare for the different versions of PyQt?
  
Yes of course, I will send the requested informations as soon as I can.
  
> I am posting this in PyQt mailing-list too, but I guess that you could
> have more ideas on that matter (Matplotlib widgets may not be used very
> often in PyQt).
    
Please don't do that. Its not fair to the people who volunteer their time on open source projects to try to draw so many people into the problem before the problem is understood.

Wow... I did not expect this reaction! :slight_smile: The only reason that I posted on the two mailing-list was to be sure to inform everyone who was potentially interested by the topic. Otherwise, if I was really trying outrageously to draw many people into the problem, I wouldn't have mentioned the post on the other mailing-list, would I? Thanks for the warm welcome though :wink:

Regards,
Pierre Raybaut

···

On Friday 30 May 2008 5:21:01 pm Pierre Raybaut wrote:

Sorry, I didn't mean to seem brusque. If there is a problem with matplotlib's
qt4 support, I would prefer to have a chance to look into it before the
problem is announced to the pyqt community.

I tried putting some print statements in backend_qt4agg to see how long it was
taking to draw the canvas:

    def draw( self ):
        """
        Draw the figure when xwindows is ready for the update
        """

        if DEBUG: print "FigureCanvasQtAgg.draw", self
        self.replot = True
        d0 = time.time()
        FigureCanvasAgg.draw(self)
        d = time.time()
        print d-d0, 'agg:draw'
        d0=d
        self.update()
        print time.time()-d0, 'qt4:update'

FigureCanvasAgg.draw(self) takes about .02 seconds, and self.update() takes
less than .0004 seconds. FigureCanvasAgg.draw is independent of qt/pyqt, so
it look like panning/zooming is limited only by how fast matplotlib/agg can
draw the canvas on my machine, which has qt-4.4.0 and PyQt4-4.4.2.

Darren

···

On Sunday 01 June 2008 04:10:45 am Pierre Raybaut wrote:

> Hi Pierre,
>
> On Friday 30 May 2008 5:21:01 pm Pierre Raybaut wrote:
>> > First, I would like to congratulate you for your work on Matplotlib. I
>> > am using Matplotlib widgets in all my current projects, embedded in
>> > PyQt graphical user interfaces.
>> >
>> > As you may know, PyQt 4.4.2 has been released a few days ago.
>> > And I found out a performance bug when embedding a Matplotlib 0.91.2
>> > canvas in a PyQt 4.4.2 object: the pan/zoom feature is very slow (with
>> > PyQt 4.3.3, and the exact same scripts, pan/zoom is real-time).
>
> Would it be possible to post some benchmarks, something a little more
> concrete, like specifically what calls are taking the most time, and how
> they compare for the different versions of PyQt?

Yes of course, I will send the requested informations as soon as I can.

>> > I am posting this in PyQt mailing-list too, but I guess that you could
>> > have more ideas on that matter (Matplotlib widgets may not be used
>> > very often in PyQt).
>
> Please don't do that. Its not fair to the people who volunteer their time
> on open source projects to try to draw so many people into the problem
> before the problem is understood.

Wow... I did not expect this reaction! :slight_smile: The only reason that I posted
on the two mailing-list was to be sure to inform everyone who was
potentially interested by the topic. Otherwise, if I was really trying
outrageously to draw many people into the problem, I wouldn't have
mentioned the post on the other mailing-list, would I? Thanks for the
warm welcome though :wink:

2008/6/3 Darren Dale <darren.dale@…143…>:

Sorry, I didn’t mean to seem brusque. If there is a problem with matplotlib’s
qt4 support, I would prefer to have a chance to look into it before the
problem is announced to the pyqt community.

No problem, I understand your concern and completely agree: I’ll be more cautious in the future.

I tried putting some print statements in backend_qt4agg to see how long it was
taking to draw the canvas:

def draw( self ):
“”"
Draw the figure when xwindows is ready for the update

   """

   if DEBUG: print "FigureCanvasQtAgg.draw", self
   self.replot = True
   d0 = time.time()
   FigureCanvasAgg.draw(self)
   d = time.time()
   print d-d0, 'agg:draw'

   d0=d
   self.update()
   print time.time()-d0, 'qt4:update'

FigureCanvasAgg.draw(self) takes about .02 seconds, and self.update() takes
less than .0004 seconds. FigureCanvasAgg.draw is independent of qt/pyqt, so

it look like panning/zooming is limited only by how fast matplotlib/agg can
draw the canvas on my machine, which has qt-4.4.0 and PyQt4-4.4.2.

On my computer, FigureCanvasAgg.draw(self) takes 16 ms (basically the same duration as yours), and self.update() takes 0 second, for both PyQt 4.3.3 and 4.4.2 - and there is still clearly a display performance issue with release 4.4.2 (apparently, the draw and update features take the same time, but on screen, panning/zooming refresh rate is clearly lower than with PyQt 4.3.3).

So it seems that it is not a good way to measure the display performance, and honestly I don’t know maplotlib enough to see how to do the right benchmark.

Pierre

···

On Sunday 01 June 2008 04:10:45 am Pierre Raybaut wrote: