@@ -713,10 +713,7 @@ def _update_patch_transform(self):
713
713
maxes it very important to call the accessor method and
714
714
not directly access the transformation member variable.
715
715
"""
716
- x0 = self .convert_xunits (self ._x0 )
717
- y0 = self .convert_yunits (self ._y0 )
718
- x1 = self .convert_xunits (self ._x1 )
719
- y1 = self .convert_yunits (self ._y1 )
716
+ x0 , y0 , x1 , y1 = self ._convert_units ()
720
717
bbox = transforms .Bbox .from_extents (x0 , y0 , x1 , y1 )
721
718
rot_trans = transforms .Affine2D ()
722
719
rot_trans .rotate_deg_around (x0 , y0 , self .angle )
@@ -729,6 +726,16 @@ def _update_x1(self):
729
726
def _update_y1 (self ):
730
727
self ._y1 = self ._y0 + self ._height
731
728
729
+ def _convert_units (self ):
730
+ '''
731
+ Convert bounds of the rectangle
732
+ '''
733
+ x0 = self .convert_xunits (self ._x0 )
734
+ y0 = self .convert_yunits (self ._y0 )
735
+ x1 = self .convert_xunits (self ._x1 )
736
+ y1 = self .convert_yunits (self ._y1 )
737
+ return x0 , y0 , x1 , y1
738
+
732
739
def get_patch_transform (self ):
733
740
self ._update_patch_transform ()
734
741
return self ._rect_transform
@@ -746,7 +753,7 @@ def get_xy(self):
746
753
return self ._x0 , self ._y0
747
754
748
755
def get_width (self ):
749
- "Return the width of the rectangle"
756
+ "Return the width of the rectangle"
750
757
return self ._width
751
758
752
759
def get_height (self ):
@@ -823,6 +830,7 @@ def set_bounds(self, *args):
823
830
self .stale = True
824
831
825
832
def get_bbox (self ):
833
+ x0 , y0 , x1 , y1 = self ._convert_units ()
826
834
return transforms .Bbox .from_extents (self ._x0 , self ._y0 ,
827
835
self ._x1 , self ._y1 )
828
836
0 commit comments