Revision: 7163
          http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7163&view=rev
Author:   jdh2358
Date:     2009-05-29 15:59:47 +0000 (Fri, 29 May 2009)

Log Message:
-----------
fixed a buglet in legend when len(handles)==1 and ncol=2

Modified Paths:
--------------
    trunk/matplotlib/lib/matplotlib/legend.py

Modified: trunk/matplotlib/lib/matplotlib/legend.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/legend.py   2009-05-29 03:52:32 UTC (rev 
7162)
+++ trunk/matplotlib/lib/matplotlib/legend.py   2009-05-29 15:59:47 UTC (rev 
7163)
@@ -110,7 +110,7 @@
                  mode=None, # mode for horizontal distribution of columns. 
None, "expand"
 
                  fancybox=None, # True use a fancy box, false use a rounded 
box, none use rc
-                 shadow = None, 
+                 shadow = None,
                  title = None, # set a title for the legend
                  bbox_to_anchor = None, # bbox that the legend will be 
anchored.
                  bbox_transform = None, # transform for the bbox
@@ -139,7 +139,7 @@
         borderaxespad      the pad between the axes and legend border
         columnspacing      the spacing between columns
         title              the legend title
-        bbox_to_anchor     the bbox that the legend will be anchored. 
+        bbox_to_anchor     the bbox that the legend will be anchored.
         bbox_transform     the transform for the bbox. transAxes if None.
         ================   
==================================================================
 
@@ -204,6 +204,9 @@
 
         del localdict
 
+        handles = list(handles)
+        if len(handles)<2:
+            ncol = 1
         self._ncol = ncol
 
         if self.numpoints <= 0:
@@ -258,7 +261,7 @@
         self._loc = loc
         self._mode = mode
         self.set_bbox_to_anchor(bbox_to_anchor, bbox_transform)
-        
+
         # We use FancyBboxPatch to draw a legend frame. The location
         # and size of the box will be updated during the drawing time.
         self.legendPatch = FancyBboxPatch(
@@ -578,13 +581,13 @@
 
         sep = self.columnspacing*fontsize
 
-        self._legend_handle_box = HPacker(pad=0, 
+        self._legend_handle_box = HPacker(pad=0,
                                           sep=sep, align="baseline",
                                           mode=mode,
                                           children=columnbox)
 
         self._legend_title_box = TextArea("")
-        
+
         self._legend_box = VPacker(pad=self.borderpad*fontsize,
                                    sep=self.labelspacing*fontsize,
                                    align="center",
@@ -722,9 +725,9 @@
 
         self._bbox_to_anchor = TransformedBbox(self._bbox_to_anchor,
                                                transform)
-            
-            
 
+
+
     def _get_anchored_bbox(self, loc, bbox, parentbbox, renderer):
         """
         Place the *bbox* inside the *parentbbox* according to a given


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

------------------------------------------------------------------------------
Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT 
is a gathering of tech-side developers & brand creativity professionals. Meet
the minds behind Google Creative Lab, Visual Complexity, Processing, & 
iPhoneDevCamp as they present alongside digital heavyweights like Barbarian 
Group, R/GA, & Big Spaceship. http://p.sf.net/sfu/creativitycat-com 
_______________________________________________
Matplotlib-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins

Reply via email to