@@ -356,15 +356,11 @@ def draw(self, renderer):
356356 Update the location of children if necessary and draw them
357357 to the given *renderer*.
358358 """
359- width , height , xdescent , ydescent , offsets = self .get_extent_offsets (
360- renderer )
361-
362- px , py = self .get_offset (width , height , xdescent , ydescent , renderer )
363-
359+ w , h , xdescent , ydescent , offsets = self .get_extent_offsets (renderer )
360+ px , py = self .get_offset (w , h , xdescent , ydescent , renderer )
364361 for c , (ox , oy ) in zip (self .get_visible_children (), offsets ):
365362 c .set_offset ((px + ox , py + oy ))
366363 c .draw (renderer )
367-
368364 bbox_artist (self , renderer , fill = False , props = dict (pad = 0. ))
369365 self .stale = False
370366
@@ -541,11 +537,8 @@ def get_extent_offsets(self, renderer):
541537
542538 def draw (self , renderer ):
543539 # docstring inherited
544- width , height , xdescent , ydescent , offsets = self .get_extent_offsets (
545- renderer )
546-
547- px , py = self .get_offset (width , height , xdescent , ydescent , renderer )
548-
540+ w , h , xdescent , ydescent , offsets = self .get_extent_offsets (renderer )
541+ px , py = self .get_offset (w , h , xdescent , ydescent , renderer )
549542 for c , (ox , oy ) in zip (self .get_visible_children (), offsets ):
550543 c .set_offset ((px + ox , py + oy ))
551544
@@ -576,8 +569,7 @@ class DrawingArea(OffsetBox):
576569 boundaries of the parent.
577570 """
578571
579- def __init__ (self , width , height , xdescent = 0. ,
580- ydescent = 0. , clip = False ):
572+ def __init__ (self , width , height , xdescent = 0. , ydescent = 0. , clip = False ):
581573 """
582574 Parameters
583575 ----------
@@ -1055,8 +1047,7 @@ def get_bbox_to_anchor(self):
10551047 if transform is None :
10561048 return self ._bbox_to_anchor
10571049 else :
1058- return TransformedBbox (self ._bbox_to_anchor ,
1059- transform )
1050+ return TransformedBbox (self ._bbox_to_anchor , transform )
10601051
10611052 def set_bbox_to_anchor (self , bbox , transform = None ):
10621053 """
@@ -1342,22 +1333,12 @@ def __init__(self, offsetbox, xy,
13421333 xy ,
13431334 xycoords = xycoords ,
13441335 annotation_clip = annotation_clip )
1345-
13461336 self .offsetbox = offsetbox
1347-
13481337 self .arrowprops = arrowprops
1349-
13501338 self .set_fontsize (fontsize )
1351-
1352- if xybox is None :
1353- self .xybox = xy
1354- else :
1355- self .xybox = xybox
1356-
1357- if boxcoords is None :
1358- self .boxcoords = xycoords
1359- else :
1360- self .boxcoords = boxcoords
1339+ self .xybox = xybox if xybox is not None else xy
1340+ self .boxcoords = boxcoords if boxcoords is not None else xycoords
1341+ self ._box_alignment = box_alignment
13611342
13621343 if arrowprops is not None :
13631344 self ._arrow_relpos = self .arrowprops .pop ("relpos" , (0.5 , 0.5 ))
@@ -1367,10 +1348,7 @@ def __init__(self, offsetbox, xy,
13671348 self ._arrow_relpos = None
13681349 self .arrow_patch = None
13691350
1370- self ._box_alignment = box_alignment
1371-
1372- # frame
1373- self .patch = FancyBboxPatch (
1351+ self .patch = FancyBboxPatch ( # frame
13741352 xy = (0.0 , 0.0 ), width = 1. , height = 1. ,
13751353 facecolor = 'w' , edgecolor = 'k' ,
13761354 mutation_scale = self .prop .get_size_in_points (),
@@ -1488,28 +1466,24 @@ def _update_position_xybox(self, renderer, xy_pixel):
14881466 bbox = self .offsetbox .get_window_extent (renderer )
14891467 self .patch .set_bounds (bbox .bounds )
14901468
1491- x , y = xy_pixel
1492-
1493- ox1 , oy1 = x , y
1469+ ox1 , oy1 = xy_pixel
14941470
14951471 if self .arrowprops :
14961472 d = self .arrowprops .copy ()
14971473
14981474 # Use FancyArrowPatch if self.arrowprops has "arrowstyle" key.
14991475
1500- # adjust the starting point of the arrow relative to
1501- # the textbox.
1502- # TODO : Rotation needs to be accounted.
1476+ # Adjust the starting point of the arrow relative to the textbox.
1477+ # TODO: Rotation needs to be accounted.
15031478 relpos = self ._arrow_relpos
15041479
15051480 ox0 = bbox .x0 + bbox .width * relpos [0 ]
15061481 oy0 = bbox .y0 + bbox .height * relpos [1 ]
15071482
1508- # The arrow will be drawn from (ox0, oy0) to (ox1,
1509- # oy1). It will be first clipped by patchA and patchB.
1510- # Then it will be shrunk by shrinkA and shrinkB
1511- # (in points). If patch A is not set, self.bbox_patch
1512- # is used.
1483+ # The arrow will be drawn from (ox0, oy0) to (ox1, oy1).
1484+ # It will be first clipped by patchA and patchB.
1485+ # Then it will be shrunk by shrinkA and shrinkB (in points).
1486+ # If patch A is not set, self.bbox_patch is used.
15131487
15141488 self .arrow_patch .set_positions ((ox0 , oy0 ), (ox1 , oy1 ))
15151489 fs = self .prop .get_size_in_points ()
0 commit comments