@@ -146,6 +146,7 @@ def __init__(self, parent, handles, labels,
146146 borderpad = None , # the whitespace inside the legend border
147147 labelspacing = None , #the vertical space between the legend entries
148148 handlelength = None , # the length of the legend handles
149+ handleheight = None , # the height of the legend handles
149150 handletextpad = None , # the pad between the legend handle and text
150151 borderaxespad = None , # the pad between the axes and legend border
151152 columnspacing = None , # spacing between columns
@@ -184,6 +185,7 @@ def __init__(self, parent, handles, labels,
184185 borderpad the fractional whitespace inside the legend border
185186 labelspacing the vertical space between the legend entries
186187 handlelength the length of the legend handles
188+ handleheight the length of the legend handles
187189 handletextpad the pad between the legend handle and text
188190 borderaxespad the pad between the axes and legend border
189191 columnspacing the spacing between columns
@@ -223,7 +225,7 @@ def __init__(self, parent, handles, labels,
223225 self ._fontsize = self .prop .get_size_in_points ()
224226
225227 propnames = ['numpoints' , 'markerscale' , 'shadow' , "columnspacing" ,
226- "scatterpoints" ]
228+ "scatterpoints" , "handleheight" ]
227229
228230 self .texts = []
229231 self .legendHandles = []
@@ -585,9 +587,9 @@ def _init_legend_box(self, handles, labels):
585587
586588 # The approximate height and descent of text. These values are
587589 # only used for plotting the legend handle.
588- height = self ._approx_text_height () * 0.7
589- descent = 0.
590-
590+ descent = 0.35 * self ._approx_text_height ()* ( self . handleheight - 0.7 )
591+ # 0.35 and 0.7 are just heuristic numbers. this may need to be improbed
592+ height = self . _approx_text_height () * self . handleheight - descent
591593 # each handle needs to be drawn inside a box of (x, y, w, h) =
592594 # (0, -descent, width, height). And their corrdinates should
593595 # be given in the display coordinates.
0 commit comments