--- lib/matplotlib/legend.py	2005-10-07 08:16:06.000000000 +0000
+++ /usr/lib/python2.4/site-packages/matplotlib/legend.py	2005-10-07 08:32:32.000000000 +0000
@@ -90,7 +90,7 @@
       'lower center'         : 8,
       'upper center'         : 9,
       'center'               : 10,
-      'upper outside right'  : 11,
+      'upper outside right'  : 11, # these only make sense with axes legends
       'center outside right' : 12,
       'lower outside right'  : 13,
 
@@ -492,23 +492,34 @@
         - width, height: the final size of the legend, axes units.
         """
         BEST, UR, UL, LL, LR, R, CL, CR, LC, UC, C, UOR, COR, LOR = range(len(self.codes))
+        
+        if self.isaxes:
+            # because we might use different linewidths on our frame, the carefully crafted alignments
+            # might screw up. To account for differing linewidths, one needs to take into account
+            # how the lines of the frame are drawn and how this offsets the legend
+            # Since I have no clue how that's done, I came up with some empirically derived fudge
+            # factors that I use to correct the alignments with (they mostly work)
+            # I know this is ugly, but I couldn't find an elegant way :-(
+            figwidth = self.get_figure().get_figwidth()*float(self.get_figure().get_dpi())
+            figheight = self.get_figure().get_figheight()*float(self.get_figure().get_dpi())
+            al, ab, aw, ah = self.parent.get_position()
+            lw = self.legendPatch.get_lw()
+            fudge_h = (lw+1)/aw/figwidth # for inside fudging
+            fudge_v = (lw+3)/aw/figheight # these still roughly make sense (linewidth converted to axes coords)
+            t = ((lw > 1 and (lw-1) or 0) - (lw >= 5 and 1 or 0))*aw
+            fudge_top = t/figheight # for outside fudging (don't ask me why the inside factors don't work on the outside
+            t1 = lw==0.0 and 1 or (-lw + 1 + int(lw)/2)/aw # random, really :-( but works
+            fudge_bottom = t1/figheight
+            
+            if self.resize_axes and (loc in (UOR, COR, LOR)):
+                # adjust axes so that legend fits neatly next to it(same padding between legend and axes
+                # as well as legend and figure border
+                space_needed = (width + 2*self.axespad) * aw + 2.*lw/figwidth # convert from axes to world(figure) lengths
+                new_aw = 1 - al - space_needed
+                self.parent.set_position((al, ab, new_aw, ah))
 
-        # because we might use different linewidths on our frame, the carefully crafted alignments
-        # might screw up. To account for differing linewidths, one needs to take into account
-        # how the lines of the frame are drawn and how this offsets the legend
-        # Since I have no clue how that's done, I came up with some empirically derived fudge
-        # factors that I use to correct the alignments with (they mostly work)
-        # I know this is ugly, but I couldn't find an elegant way :-(
-        figwidth = self.get_figure().get_figwidth()*float(self.get_figure().get_dpi())
-        figheight = self.get_figure().get_figheight()*float(self.get_figure().get_dpi())
-        al, ab, aw, ah = self.parent.get_position()
-        lw = self.legendPatch.get_lw()
-        fudge_h = (lw+1)/aw/figwidth # for inside fudging
-        fudge_v = (lw+3)/aw/figheight # these still roughly make sense (linewidth converted to axes coords)
-        t = ((lw > 1 and (lw-1) or 0) - (lw >= 5 and 1 or 0))*aw
-        fudge_top = t/figheight # for outside fudging (don't ask me why the inside factors don't work on the outside
-        t1 = lw==0.0 and 1 or (-lw + 1 + int(lw)/2)/aw # random, really :-( but works
-        fudge_bottom = t1/figheight
+        else: # don't do any funky things with figure legends
+            fudge_h, fudge_v, fudge_top, fudge_bottom = 0,0,0,0
         
         left = self.axespad + fudge_h
         right = 1.0 - (self.axespad + fudge_h+ width)
@@ -519,13 +530,6 @@
         # special computation for outside
         outsidex = 1.0 + self.axespad + fudge_h
         
-        if self.resize_axes and (loc in (UOR, COR, LOR)):
-            # adjust axes so that legend fits neatly next to it(same padding between legend and axes
-            # as well as legend and figure border
-            space_needed = (width + 2*self.axespad) * aw + 2.*lw/figwidth # convert from axes to world(figure) lengths
-            new_aw = 1 - al - space_needed
-            self.parent.set_position((al, ab, new_aw, ah))
-
         if loc == UR:
             return right, upper
         if loc == UL:
