Darren,

Can you test the attached patch and see if the legend is placed where
you expected.
Regards,

-JJ
Index: lib/matplotlib/legend.py
===================================================================
--- lib/matplotlib/legend.py	(revision 6477)
+++ lib/matplotlib/legend.py	(working copy)
@@ -290,8 +290,16 @@
 
     def _findoffset_loc(self, width, height, xdescent, ydescent):
         "Heper function to locate the legend"
-        bbox = Bbox.from_bounds(0, 0, width, height)
-        x, y = self._get_anchored_bbox(self._loc, bbox, self.parent.bbox)
+
+        if iterable(self._loc) and len(self._loc)==2:
+            # when loc is a tuple of axes(or figure) coordinates.
+            fx, fy = self._loc
+            bbox = self.parent.bbox
+            x, y = bbox.x0 + bbox.width * fx, bbox.y0 + bbox.height * fy
+        else:
+            bbox = Bbox.from_bounds(0, 0, width, height)
+            x, y = self._get_anchored_bbox(self._loc, bbox, self.parent.bbox)
+
         return x+xdescent, y+ydescent
 
     def draw(self, renderer):
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel

Reply via email to