AttributeError: _pan_start

I have an application with two matplotlib figures, both using the gtkAgg
backend. One or the other is displayed on the screen depending on the
GUI state. Initially after creating the two figures, I can interact with
both of them just fine, but after switching between figures two or three
times the figure becomes sluggish in handling pans and zooms, and I
start getting errors like this while panning:

Traceback (most recent call last):
  File
"/usr/lib/pymodules/python2.6/matplotlib/backends/backend_gtk.py", line
216, in button_release_event
    FigureCanvasBase.button_release_event(self, x, y, event.button,
guiEvent=event)
  File "/usr/lib/pymodules/python2.6/matplotlib/backend_bases.py", line
1219, in button_release_event
    self.callbacks.process(s, event)
  File "/usr/lib/pymodules/python2.6/matplotlib/cbook.py", line 165, in
process
    func(*args, **kwargs)
  File "/usr/lib/pymodules/python2.6/matplotlib/backend_bases.py", line
2016, in release_pan
    a.end_pan()
  File "/usr/lib/pymodules/python2.6/matplotlib/axes.py", line 2458, in
end_pan
    del self._pan_start
AttributeError: _pan_start

I tried to create a minimum working example but so far have been
unsuccessful; the problem did not recur in the simpler program I created.

Can anyone suggest to me where I would look to find what could cause
this error and the (presumably related) performance degradation?

This is a wild guess -- sounds like a race condition where the mouse up event is somehow getting fired before the mouse down event.

In your more complex example, are you adding/removing axes while interacting with the plots?

You could try "papering over" this problem by replacing Axes.end_pan with the following (I'm not entirely sure this is a good idea, but I'm curious if it prevents the sluggishness):

     def end_pan(self):
         """
         Called when a pan operation completes (when the mouse button
         is up.)

         .. note::
             Intended to be overridden by new projection types.
         """
         if hasattr(self, '_pan_start'):
             del self._pan_start

Mike

···

On 12/18/2010 01:52 PM, John Haiducek wrote:

I have an application with two matplotlib figures, both using the gtkAgg
backend. One or the other is displayed on the screen depending on the
GUI state. Initially after creating the two figures, I can interact with
both of them just fine, but after switching between figures two or three
times the figure becomes sluggish in handling pans and zooms, and I
start getting errors like this while panning:

Traceback (most recent call last):
   File
"/usr/lib/pymodules/python2.6/matplotlib/backends/backend_gtk.py", line
216, in button_release_event
     FigureCanvasBase.button_release_event(self, x, y, event.button,
guiEvent=event)
   File "/usr/lib/pymodules/python2.6/matplotlib/backend_bases.py", line
1219, in button_release_event
     self.callbacks.process(s, event)
   File "/usr/lib/pymodules/python2.6/matplotlib/cbook.py", line 165, in
process
     func(*args, **kwargs)
   File "/usr/lib/pymodules/python2.6/matplotlib/backend_bases.py", line
2016, in release_pan
     a.end_pan()
   File "/usr/lib/pymodules/python2.6/matplotlib/axes.py", line 2458, in
end_pan
     del self._pan_start
AttributeError: _pan_start

I tried to create a minimum working example but so far have been
unsuccessful; the problem did not recur in the simpler program I created.

Can anyone suggest to me where I would look to find what could cause
this error and the (presumably related) performance degradation?

------------------------------------------------------------------------------
Lotusphere 2011
Register now for Lotusphere 2011 and learn how
to connect the dots, take your collaborative environment
to the next level, and enter the era of Social Business.
http://p.sf.net/sfu/lotusphere-d2d
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users
   
--
Michael Droettboom
Science Software Branch
Space Telescope Science Institute
Baltimore, Maryland, USA

No, I’m not adding or removing axes while interacting. (A single axes instance gets created when the figure is instantiated and remains the life of the figure.)

Thans for the suggestion of replacing Axes.end_pan. Unfortunately I’ve left on a trip since my initial post so it will be a while before I can try it.

···

On Dec 20, 2010 8:20 AM, “Michael Droettboom” <mdroe@…86…> wrote:

This is a wild guess – sounds like a race condition where the mouse up

event is somehow getting fired before the mouse down event.

In your more complex example, are you adding/removing axes while
interacting with the plots?

You could try “papering over” this problem by replacing Axes.end_pan

with the following (I’m not entirely sure this is a good idea, but I’m
curious if it prevents the sluggishness):

def end_pan(self):
“”"
Called when a pan operation completes (when the mouse button

is up.)

… note::
Intended to be overridden by new projection types.
“”"
if hasattr(self, ‘_pan_start’):

del self._pan_start

Mike

On 12/18/2010 01:52 PM, John Haiducek wrote:

I have an application with two matplotlib figures, both using the gtkAgg
backend. One or the other is displayed on the screen depending on the

GUI state. Initially after creating the two figures, I can interact with
both of them just fine, but after switching between figures two or three
times the figure becomes sluggish in handling pans and zooms, and I

start getting errors like this while panning:

Traceback (most recent call last):
File
“/usr/lib/pymodules/python2.6/matplotlib/backends/backend_gtk.py”, line

216, in button_release_event
FigureCanvasBase.button_release_event(self, x, y, event.button,
guiEvent=event)
File “/usr/lib/pymodules/python2.6/matplotlib/backend_bases.py”, line

1219, in button_release_event
self.callbacks.process(s, event)
File “/usr/lib/pymodules/python2.6/matplotlib/cbook.py”, line 165, in
process
func(*args, **kwargs)

File “/usr/lib/pymodules/python2.6/matplotlib/backend_bases.py”, line
2016, in release_pan
a.end_pan()
File “/usr/lib/pymodules/python2.6/matplotlib/axes.py”, line 2458, in

end_pan
del self._pan_start
AttributeError: _pan_start

I tried to create a minimum working example but so far have been
unsuccessful; the problem did not recur in the simpler program I created.

Can anyone suggest to me where I would look to find what could cause
this error and the (presumably related) performance degradation?


Lotusphere 2011
Register now for Lotusphere 2011 and learn how
to connect the dots, take your collaborative environment
to the next level, and enter the era of Social Business.

http://p.sf.net/sfu/lotusphere-d2d


Matplotlib-users mailing list
Matplotlib-users@…2982…e.net

https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Michael Droettboom

Science Software Branch
Space Telescope Science Institute
Baltimore, Maryland, USA


Lotusphere 2011

Register now for Lotusphere 2011 and learn how
to connect the dots, take your collaborative environment
to the next level, and enter the era of Social Business.
http://p.sf.net/sfu/lotusphere-d2d


Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users