Revision: 8734 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=8734&view=rev Author: leejjoon Date: 2010-10-08 01:23:22 +0000 (Fri, 08 Oct 2010)
Log Message: ----------- fix bbox_to_anchor for draggable legend Modified Paths: -------------- branches/v1_0_maint/lib/matplotlib/legend.py Modified: branches/v1_0_maint/lib/matplotlib/legend.py =================================================================== --- branches/v1_0_maint/lib/matplotlib/legend.py 2010-10-07 14:19:00 UTC (rev 8733) +++ branches/v1_0_maint/lib/matplotlib/legend.py 2010-10-08 01:23:22 UTC (rev 8734) @@ -51,11 +51,17 @@ loc_in_canvas = self.get_loc_in_canvas() bbox = self.legend.get_bbox_to_anchor() + + # if bbox has zero width or height, the transformation is + # ill-defined. Fall back to the defaul bbox_to_anchor. + if bbox.width ==0 or bbox.height ==0: + self.legend.set_bbox_to_anchor(None) + bbox = self.legend.get_bbox_to_anchor() + _bbox_transform = BboxTransformFrom(bbox) self.legend._loc = tuple(_bbox_transform.transform_point(loc_in_canvas)) - class Legend(Artist): """ Place a legend on the axes at location loc. Labels are a This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. ------------------------------------------------------------------------------ Beautiful is writing same markup. Internet Explorer 9 supports standards for HTML5, CSS3, SVG 1.1, ECMAScript5, and DOM L2 & L3. Spend less time writing and rewriting code and more time creating great experiences on the web. Be a part of the beta today. http://p.sf.net/sfu/beautyoftheweb _______________________________________________ Matplotlib-checkins mailing list Matplotlib-checkins@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins