@@ -110,7 +110,7 @@ def __init__(self, parent, handles, labels,
110110 mode = None , # mode for horizontal distribution of columns. None, "expand"
111111
112112 fancybox = None , # True use a fancy box, false use a rounded box, none use rc
113- shadow = None ,
113+ shadow = None ,
114114 title = None , # set a title for the legend
115115 bbox_to_anchor = None , # bbox that the legend will be anchored.
116116 bbox_transform = None , # transform for the bbox
@@ -139,7 +139,7 @@ def __init__(self, parent, handles, labels,
139139 borderaxespad the pad between the axes and legend border
140140 columnspacing the spacing between columns
141141 title the legend title
142- bbox_to_anchor the bbox that the legend will be anchored.
142+ bbox_to_anchor the bbox that the legend will be anchored.
143143 bbox_transform the transform for the bbox. transAxes if None.
144144 ================ ==================================================================
145145
@@ -204,6 +204,9 @@ def __init__(self, parent, handles, labels,
204204
205205 del localdict
206206
207+ handles = list (handles )
208+ if len (handles )< 2 :
209+ ncol = 1
207210 self ._ncol = ncol
208211
209212 if self .numpoints <= 0 :
@@ -258,7 +261,7 @@ def __init__(self, parent, handles, labels,
258261 self ._loc = loc
259262 self ._mode = mode
260263 self .set_bbox_to_anchor (bbox_to_anchor , bbox_transform )
261-
264+
262265 # We use FancyBboxPatch to draw a legend frame. The location
263266 # and size of the box will be updated during the drawing time.
264267 self .legendPatch = FancyBboxPatch (
@@ -578,13 +581,13 @@ def _init_legend_box(self, handles, labels):
578581
579582 sep = self .columnspacing * fontsize
580583
581- self ._legend_handle_box = HPacker (pad = 0 ,
584+ self ._legend_handle_box = HPacker (pad = 0 ,
582585 sep = sep , align = "baseline" ,
583586 mode = mode ,
584587 children = columnbox )
585588
586589 self ._legend_title_box = TextArea ("" )
587-
590+
588591 self ._legend_box = VPacker (pad = self .borderpad * fontsize ,
589592 sep = self .labelspacing * fontsize ,
590593 align = "center" ,
@@ -722,8 +725,8 @@ def set_bbox_to_anchor(self, bbox, transform=None):
722725
723726 self ._bbox_to_anchor = TransformedBbox (self ._bbox_to_anchor ,
724727 transform )
725-
726-
728+
729+
727730
728731 def _get_anchored_bbox (self , loc , bbox , parentbbox , renderer ):
729732 """
0 commit comments