From: <jr...@us...> - 2008-09-15 16:09:28
|
Revision: 6097 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6097&view=rev Author: jrevans Date: 2008-09-15 23:09:24 +0000 (Mon, 15 Sep 2008) Log Message: ----------- Fixed contour to now properly strip away units for unitized data on the x and y axes. Unit registry now properly determines the registered converter to use for nested array data types. Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/contour.py trunk/matplotlib/lib/matplotlib/units.py Modified: trunk/matplotlib/lib/matplotlib/contour.py =================================================================== --- trunk/matplotlib/lib/matplotlib/contour.py 2008-09-15 19:59:47 UTC (rev 6096) +++ trunk/matplotlib/lib/matplotlib/contour.py 2008-09-15 23:09:24 UTC (rev 6097) @@ -724,8 +724,12 @@ Possible change: I think we should make and use an ArgumentError Exception class (here and elsewhere). ''' - x = np.asarray(args[0], dtype=np.float64) - y = np.asarray(args[1], dtype=np.float64) + # We can strip away the x and y units + x = self.ax.convert_xunits( args[0] ) + y = self.ax.convert_yunits( args[1] ) + + x = np.asarray(x, dtype=np.float64) + y = np.asarray(y, dtype=np.float64) z = ma.asarray(args[2], dtype=np.float64) if z.ndim != 2: raise TypeError("Input z must be a 2D array.") Modified: trunk/matplotlib/lib/matplotlib/units.py =================================================================== --- trunk/matplotlib/lib/matplotlib/units.py 2008-09-15 19:59:47 UTC (rev 6096) +++ trunk/matplotlib/lib/matplotlib/units.py 2008-09-15 23:09:24 UTC (rev 6097) @@ -128,12 +128,9 @@ if converter is None and iterable(x): for thisx in x: - classx = getattr(thisx, '__class__', None) - break - if classx is not None: - converter = self.get(classx) + converter = self.get_converter( thisx ) + if converter: break - #DISABLED self._cached[idx] = converter return converter This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |