From: <jr...@us...> - 2007-12-06 00:04:51
|
Revision: 4636 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4636&view=rev Author: jrevans Date: 2007-12-05 16:04:49 -0800 (Wed, 05 Dec 2007) Log Message: ----------- Added a 'data offset' coordinate to the Annotation class. Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/text.py Modified: trunk/matplotlib/lib/matplotlib/text.py =================================================================== --- trunk/matplotlib/lib/matplotlib/text.py 2007-12-05 23:01:05 UTC (rev 4635) +++ trunk/matplotlib/lib/matplotlib/text.py 2007-12-06 00:04:49 UTC (rev 4636) @@ -1080,6 +1080,24 @@ x = float(self.convert_xunits(x)) y = float(self.convert_yunits(y)) return trans.xy_tup((x,y)) + elif s=='data offset': + # convert the data point + dx, dy = self.xy + trans = self.axes.transData + dx = float(self.convert_xunits(dx)) + dy = float(self.convert_yunits(dy)) + dx, dy = trans.xy_tup((dx, dy)) + + # convert the offset + dpi = self.figure.dpi.get() + x *= dpi/72. + y *= dpi/72. + + # add the offset to the data point + x += dx + y += dy + + return x, y elif s=='polar': theta, r = x, y x = r*npy.cos(theta) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |