@@ -53,7 +53,7 @@ def finalize_offset(self):
53
53
bbox = self .legend .get_bbox_to_anchor ()
54
54
_bbox_transform = BboxTransformFrom (bbox )
55
55
self .legend ._loc = tuple (_bbox_transform .transform_point (loc_in_canvas ))
56
-
56
+
57
57
58
58
59
59
class Legend (Artist ):
@@ -256,7 +256,7 @@ def __init__(self, parent, handles, labels,
256
256
self ._scatteryoffsets = np .array ([3. / 8. , 4. / 8. , 2.5 / 8. ])
257
257
else :
258
258
self ._scatteryoffsets = np .asarray (scatteryoffsets )
259
- reps = int (self .numpoints / len (self ._scatteryoffsets )) + 1
259
+ reps = int (self .scatterpoints / len (self ._scatteryoffsets )) + 1
260
260
self ._scatteryoffsets = np .tile (self ._scatteryoffsets , reps )[:self .scatterpoints ]
261
261
262
262
# _legend_box is an OffsetBox instance that contains all
@@ -519,6 +519,9 @@ def _init_legend_box(self, handles, labels):
519
519
legline_marker .set_clip_box (None )
520
520
legline_marker .set_clip_path (None )
521
521
legline_marker .set_linestyle ('None' )
522
+ if self .markerscale != 1 :
523
+ newsz = legline_marker .get_markersize ()* self .markerscale
524
+ legline_marker .set_markersize (newsz )
522
525
# we don't want to add this to the return list because
523
526
# the texts and handles are assumed to be in one-to-one
524
527
# correpondence.
@@ -554,11 +557,8 @@ def _init_legend_box(self, handles, labels):
554
557
#ydata = self._scatteryoffsets
555
558
ydata = height * self ._scatteryoffsets
556
559
557
- size_max , size_min = max (handle .get_sizes ()),\
558
- min (handle .get_sizes ())
559
- # we may need to scale these sizes by "markerscale"
560
- # attribute. But other handle types does not seem
561
- # to care about this attribute and it is currently ignored.
560
+ size_max , size_min = max (handle .get_sizes ())* self .markerscale ** 2 ,\
561
+ min (handle .get_sizes ())* self .markerscale ** 2
562
562
if self .scatterpoints < 4 :
563
563
sizes = [.5 * (size_max + size_min ), size_max ,
564
564
size_min ]
@@ -582,11 +582,8 @@ def _init_legend_box(self, handles, labels):
582
582
583
583
ydata = height * self ._scatteryoffsets
584
584
585
- size_max , size_min = max (handle .get_sizes ()),\
586
- min (handle .get_sizes ())
587
- # we may need to scale these sizes by "markerscale"
588
- # attribute. But other handle types does not seem
589
- # to care about this attribute and it is currently ignored.
585
+ size_max , size_min = max (handle .get_sizes ())* self .markerscale ** 2 ,\
586
+ min (handle .get_sizes ())* self .markerscale ** 2
590
587
if self .scatterpoints < 4 :
591
588
sizes = [.5 * (size_max + size_min ), size_max ,
592
589
size_min ]
@@ -937,7 +934,7 @@ def draggable(self, state=None, use_blit=False):
937
934
* True : turn draggable on
938
935
939
936
* False : turn draggable off
940
-
937
+
941
938
If draggable is on, you can drag the legend on the canvas with
942
939
the mouse. The DraggableLegend helper instance is returned if
943
940
draggable is on.
@@ -947,7 +944,7 @@ def draggable(self, state=None, use_blit=False):
947
944
# if state is None we'll toggle
948
945
if state is None :
949
946
state = not is_draggable
950
-
947
+
951
948
if state :
952
949
if self ._draggable is None :
953
950
self ._draggable = DraggableLegend (self , use_blit )
0 commit comments