From: <md...@us...> - 2007-11-14 19:07:01
|
Revision: 4287 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4287&view=rev Author: mdboom Date: 2007-11-14 11:06:52 -0800 (Wed, 14 Nov 2007) Log Message: ----------- Fix placement of rotated text in Wx backend (thanks Michael Day). Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/backends/backend_wx.py Modified: trunk/matplotlib/lib/matplotlib/backends/backend_wx.py =================================================================== --- trunk/matplotlib/lib/matplotlib/backends/backend_wx.py 2007-11-14 18:44:39 UTC (rev 4286) +++ trunk/matplotlib/lib/matplotlib/backends/backend_wx.py 2007-11-14 19:06:52 UTC (rev 4287) @@ -381,7 +381,12 @@ y = int(y-h) if angle!=0: - try: gc.DrawRotatedText(s, x, y, angle) + # Correct for the fact that text if rotated around the upper-left corner, + # rather than the lower-left corner as we expect. + rads = angle / 180.0 * math.pi + xo = h * math.sin(rads) + yo = h * math.cos(rads) + try: gc.DrawRotatedText(s, x - xo, y - yo, angle) except: verbose.print_error(exception_to_str('WX rotated text failed')) else: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |