[Mac OS 10.4.10, Python 2.5] LineCollection error

Hi! I have some code importing MPL and wxmpl; presently, I have version 0.90.1 of the former installed and 1.2.8 of the latter. I hadn't run this code in a while; when I last did, in the late spring sometime, it worked fine. Now, when I do (from the command line), a call in it to <class-derived-from-wxmpl.PlotPanel>.Axes.clear() results in an error seq. ending in AttributeError: VectorLineCollection instance has no attribute 'get_xdata'. One "catch": the "old" version still exists as a py2app-ed stand-alone; I tried it and sure enough, it still works fine. By searching its Mac App file tree, I was able to determine that this old py2app-ed version is using version 0.90.0 of MPL; unfortunately, it (appears to be) using a compiled version of wxmpl, so I don't know how to determine what version of that its using. Did the update of MPL from 0.90.0 to 0.90.1 change anything that might result in this error; has there been a change in wxmpl which might result in this error? (Between then and now, I switched to a new Mac and installed everything from scratch, so it's very likely that my present version of wxmpl is different from the one I had installed when I created the py2app.) Any other ideas? (I'm at a total loss.) Thanks!

DG

···

--
ERD/ORR/NOS/NOAA <http://response.restoration.noaa.gov/emergencyresponse/>

David,

I'm not aware of any compatibility problems when using WxMpl with MPL 0.91, but then again I can't remember if I ever tested it thoroughly.

Could you please send me a short script that reproduces the problem, along with the complete error message it generates? Thanks.

Ken

Original posts attached.

Ken McIvor wrote:

David,

I'm not aware of any compatibility problems when using WxMpl with MPL 0.91, but then again I can't remember if I ever tested it thoroughly.

Could you please send me a short script that reproduces the problem, along with the complete error message it generates? Thanks.

Ken

OK, finally had cause to work on this some more. With Chris Barker's help:

0) Tried unsuccessfully to reproduce the problem in a "minimal" app. (i.e., quoting Chris: "it's difficult to build a minimal app. which reproduces the problem");

1) We kluged a fix by manually adding get_xdata and get_ydata methods to our derived class, but a) this seems like it shouldn't be necessary, and b) it wasn't necessary before;

2) Chris' hypothesis is that it has something to do w/ the work being done on matplotlib to add units to data objects (please correct me if I'm wrong, Chris) but is uncertain of precisely how or why, and wasn't readily able to pin it down more than that;

3) We're both rather amazed that no one else has yet reported this problem, suggesting that either a) we don't scan posts to this list carefully enough :-), or b) there's perhaps something wrong w/ my installation?

Bottom line: working, but w/ an "unsatisfactory" solution.

DG

Attached Message (4.52 KB)

1) We kluged a fix by manually adding get_xdata and get_ydata methods to our derived class, but a) this seems like it shouldn't be necessary, and b) it wasn't necessary before;

2) Chris' hypothesis is that it has something to do w/ the work being done on matplotlib to add units to data objects (please correct me if I'm wrong, Chris) but is uncertain of precisely how or why, and wasn't readily able to pin it down more than that;

The traceback gave me this hint (see below):

The error comes when axis.clear() is called, inside:

  self.set_units(None)

so I thought it might have to do with the unit stuff. The error is really:
in set_units
     self.callbacks.process('units finalize')
in process
     func(*args, **kwargs)
in relim
     self._update_line_limits(line)

and that's where it wants the LineCollection to have get_xdata

What's really odd about this is that we're clearing the axis - the LineCollection should be irrelevant then!

I do remember something with the auto-limits and LineCollections when I first started messing with this, but I don't remember what.

Sorry we haven't been able to duplicate this in a small sample yet.

Anyone have any ideas?

-Chris

Here's the whole traceback:

Traceback (most recent call last):

   File "/Users/cbarker/HAZMAT/3d/TABS/TabsDataPanels.py", line 688, in PlotProfile
     int(self.DataSelector.BotBin) )

   File "/Users/cbarker/HAZMAT/3d/TABS/TabsDataPanels.py", line 351, in PlotProfile
     ax.clear()

   File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/matplotlib/axes.py", line 725, in clear
     self.cla()

   File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/matplotlib/axes.py", line 670, in cla
     self.xaxis.cla()

   File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/matplotlib/axis.py", line 563, in cla
     self.set_units(None)

   File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/matplotlib/axis.py", line 859, in set_units
     self.callbacks.process('units finalize')

   File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/matplotlib/cbook.py", line 83, in process
     func(*args, **kwargs)

   File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/matplotlib/axes.py", line 1104, in relim
     self._update_line_limits(line)

   File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/matplotlib/axes.py", line 1064, in _update_line_limits
     xdata = line.get_xdata(orig=False)

AttributeError: VectorLineCollection instance has no attribute 'get_xdata'

···

--
Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception

Chris.Barker@...259...