@@ -592,24 +592,19 @@ def __init__(self, child, pad=None, draw_frame=False, patch_attrs=None):
592592 Additional parameters passed to the contained `.FancyBboxPatch`.
593593 """
594594 super ().__init__ ()
595-
596595 self .pad = pad
597596 self ._children = [child ]
598-
599597 self .patch = FancyBboxPatch (
600598 xy = (0.0 , 0.0 ), width = 1. , height = 1. ,
601599 facecolor = 'w' , edgecolor = 'k' ,
602600 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+ )
608605 if patch_attrs is not None :
609606 self .patch .update (patch_attrs )
610607
611- self ._drawFrame = draw_frame
612-
613608 def get_extent_offsets (self , renderer ):
614609 # docstring inherited.
615610 dpicor = renderer .points_to_pixels (1. )
@@ -637,20 +632,15 @@ def draw(self, renderer):
637632 self .stale = False
638633
639634 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 )
643636 if fontsize :
644637 self .patch .set_mutation_scale (fontsize )
645638 self .stale = True
646639
647640 def draw_frame (self , renderer ):
648641 # 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 )
654644
655645
656646class DrawingArea (OffsetBox ):
@@ -1110,10 +1100,10 @@ def __init__(self, loc,
11101100 xy = (0.0 , 0.0 ), width = 1. , height = 1. ,
11111101 facecolor = 'w' , edgecolor = 'k' ,
11121102 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+ )
11171107
11181108 def set_child (self , child ):
11191109 """Set the child to be anchored."""
@@ -1210,26 +1200,22 @@ def _offset(w, h, xd, yd, renderer, fontsize=fontsize, self=self):
12101200 self .set_offset (_offset )
12111201
12121202 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 )
12161204 if fontsize :
12171205 self .patch .set_mutation_scale (fontsize )
12181206
12191207 def draw (self , renderer ):
12201208 # docstring inherited
1221-
12221209 if not self .get_visible ():
12231210 return
12241211
12251212 fontsize = renderer .points_to_pixels (self .prop .get_size_in_points ())
12261213 self ._update_offset_func (renderer , fontsize )
12271214
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 )
12331219
12341220 width , height , xdescent , ydescent = self .get_extent (renderer )
12351221
@@ -1512,12 +1498,12 @@ def __init__(self, offsetbox, xy,
15121498 xy = (0.0 , 0.0 ), width = 1. , height = 1. ,
15131499 facecolor = 'w' , edgecolor = 'k' ,
15141500 mutation_scale = self .prop .get_size_in_points (),
1515- snap = True
1516- )
1501+ snap = True ,
1502+ visible = frameon ,
1503+ )
15171504 self .patch .set_boxstyle ("square" , pad = pad )
15181505 if bboxprops :
15191506 self .patch .set (** bboxprops )
1520- self ._drawFrame = frameon
15211507
15221508 @property
15231509 def xyann (self ):
@@ -1670,9 +1656,7 @@ def draw(self, renderer):
16701656 self .arrow_patch .figure = self .figure
16711657 self .arrow_patch .draw (renderer )
16721658
1673- if self ._drawFrame :
1674- self .patch .draw (renderer )
1675-
1659+ self .patch .draw (renderer )
16761660 self .offsetbox .draw (renderer )
16771661 self .stale = False
16781662
0 commit comments