@@ -592,24 +592,19 @@ def __init__(self, child, pad=None, draw_frame=False, patch_attrs=None):
592
592
Additional parameters passed to the contained `.FancyBboxPatch`.
593
593
"""
594
594
super ().__init__ ()
595
-
596
595
self .pad = pad
597
596
self ._children = [child ]
598
-
599
597
self .patch = FancyBboxPatch (
600
598
xy = (0.0 , 0.0 ), width = 1. , height = 1. ,
601
599
facecolor = 'w' , edgecolor = 'k' ,
602
600
mutation_scale = 1 , # self.prop.get_size_in_points(),
603
- snap = True
604
- )
605
-
606
- self .patch .set_boxstyle ("square" , pad = 0 )
607
-
601
+ snap = True ,
602
+ visible = draw_frame ,
603
+ boxstyle = "square,pad=0" ,
604
+ )
608
605
if patch_attrs is not None :
609
606
self .patch .update (patch_attrs )
610
607
611
- self ._drawFrame = draw_frame
612
-
613
608
def get_extent_offsets (self , renderer ):
614
609
# docstring inherited.
615
610
dpicor = renderer .points_to_pixels (1. )
@@ -637,20 +632,15 @@ def draw(self, renderer):
637
632
self .stale = False
638
633
639
634
def update_frame (self , bbox , fontsize = None ):
640
- self .patch .set_bounds (bbox .x0 , bbox .y0 ,
641
- bbox .width , bbox .height )
642
-
635
+ self .patch .set_bounds (bbox .x0 , bbox .y0 , bbox .width , bbox .height )
643
636
if fontsize :
644
637
self .patch .set_mutation_scale (fontsize )
645
638
self .stale = True
646
639
647
640
def draw_frame (self , renderer ):
648
641
# update the location and size of the legend
649
- bbox = self .get_window_extent (renderer )
650
- self .update_frame (bbox )
651
-
652
- if self ._drawFrame :
653
- self .patch .draw (renderer )
642
+ self .update_frame (self .get_window_extent (renderer ))
643
+ self .patch .draw (renderer )
654
644
655
645
656
646
class DrawingArea (OffsetBox ):
@@ -1110,10 +1100,10 @@ def __init__(self, loc,
1110
1100
xy = (0.0 , 0.0 ), width = 1. , height = 1. ,
1111
1101
facecolor = 'w' , edgecolor = 'k' ,
1112
1102
mutation_scale = self .prop .get_size_in_points (),
1113
- snap = True
1114
- )
1115
- self . patch . set_boxstyle ( "square" , pad = 0 )
1116
- self . _drawFrame = frameon
1103
+ snap = True ,
1104
+ visible = frameon ,
1105
+ boxstyle = "square, pad=0" ,
1106
+ )
1117
1107
1118
1108
def set_child (self , child ):
1119
1109
"""Set the child to be anchored."""
@@ -1210,26 +1200,22 @@ def _offset(w, h, xd, yd, renderer, fontsize=fontsize, self=self):
1210
1200
self .set_offset (_offset )
1211
1201
1212
1202
def update_frame (self , bbox , fontsize = None ):
1213
- self .patch .set_bounds (bbox .x0 , bbox .y0 ,
1214
- bbox .width , bbox .height )
1215
-
1203
+ self .patch .set_bounds (bbox .x0 , bbox .y0 , bbox .width , bbox .height )
1216
1204
if fontsize :
1217
1205
self .patch .set_mutation_scale (fontsize )
1218
1206
1219
1207
def draw (self , renderer ):
1220
1208
# docstring inherited
1221
-
1222
1209
if not self .get_visible ():
1223
1210
return
1224
1211
1225
1212
fontsize = renderer .points_to_pixels (self .prop .get_size_in_points ())
1226
1213
self ._update_offset_func (renderer , fontsize )
1227
1214
1228
- if self ._drawFrame :
1229
- # update the location and size of the legend
1230
- bbox = self .get_window_extent (renderer )
1231
- self .update_frame (bbox , fontsize )
1232
- self .patch .draw (renderer )
1215
+ # update the location and size of the legend
1216
+ bbox = self .get_window_extent (renderer )
1217
+ self .update_frame (bbox , fontsize )
1218
+ self .patch .draw (renderer )
1233
1219
1234
1220
width , height , xdescent , ydescent = self .get_extent (renderer )
1235
1221
@@ -1512,12 +1498,12 @@ def __init__(self, offsetbox, xy,
1512
1498
xy = (0.0 , 0.0 ), width = 1. , height = 1. ,
1513
1499
facecolor = 'w' , edgecolor = 'k' ,
1514
1500
mutation_scale = self .prop .get_size_in_points (),
1515
- snap = True
1516
- )
1501
+ snap = True ,
1502
+ visible = frameon ,
1503
+ )
1517
1504
self .patch .set_boxstyle ("square" , pad = pad )
1518
1505
if bboxprops :
1519
1506
self .patch .set (** bboxprops )
1520
- self ._drawFrame = frameon
1521
1507
1522
1508
@property
1523
1509
def xyann (self ):
@@ -1670,9 +1656,7 @@ def draw(self, renderer):
1670
1656
self .arrow_patch .figure = self .figure
1671
1657
self .arrow_patch .draw (renderer )
1672
1658
1673
- if self ._drawFrame :
1674
- self .patch .draw (renderer )
1675
-
1659
+ self .patch .draw (renderer )
1676
1660
self .offsetbox .draw (renderer )
1677
1661
self .stale = False
1678
1662
0 commit comments