@@ -687,10 +687,7 @@ def _update_patch_transform(self):
687
687
makes it very important to call the accessor method and
688
688
not directly access the transformation member variable.
689
689
"""
690
- x0 = self .convert_xunits (self ._x0 )
691
- y0 = self .convert_yunits (self ._y0 )
692
- x1 = self .convert_xunits (self ._x1 )
693
- y1 = self .convert_yunits (self ._y1 )
690
+ x0 , y0 , x1 , y1 = self ._convert_units ()
694
691
bbox = transforms .Bbox .from_extents (x0 , y0 , x1 , y1 )
695
692
rot_trans = transforms .Affine2D ()
696
693
rot_trans .rotate_deg_around (x0 , y0 , self .angle )
@@ -703,6 +700,16 @@ def _update_x1(self):
703
700
def _update_y1 (self ):
704
701
self ._y1 = self ._y0 + self ._height
705
702
703
+ def _convert_units (self ):
704
+ '''
705
+ Convert bounds of the rectangle
706
+ '''
707
+ x0 = self .convert_xunits (self ._x0 )
708
+ y0 = self .convert_yunits (self ._y0 )
709
+ x1 = self .convert_xunits (self ._x1 )
710
+ y1 = self .convert_yunits (self ._y1 )
711
+ return x0 , y0 , x1 , y1
712
+
706
713
def get_patch_transform (self ):
707
714
self ._update_patch_transform ()
708
715
return self ._rect_transform
@@ -720,7 +727,7 @@ def get_xy(self):
720
727
return self ._x0 , self ._y0
721
728
722
729
def get_width (self ):
723
- "Return the width of the rectangle"
730
+ "Return the width of the rectangle"
724
731
return self ._width
725
732
726
733
def get_height (self ):
@@ -797,6 +804,7 @@ def set_bounds(self, *args):
797
804
self .stale = True
798
805
799
806
def get_bbox (self ):
807
+ x0 , y0 , x1 , y1 = self ._convert_units ()
800
808
return transforms .Bbox .from_extents (self ._x0 , self ._y0 ,
801
809
self ._x1 , self ._y1 )
802
810
0 commit comments