Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 672fd4c

Browse files
committed
Add angle property to Rectangle
1 parent d195747 commit 672fd4c

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

lib/matplotlib/patches.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -754,7 +754,7 @@ def __init__(self, xy, width, height, angle=0.0, **kwargs):
754754
self._y0 = xy[1]
755755
self._width = width
756756
self._height = height
757-
self.angle = float(angle)
757+
self._angle = float(angle)
758758
self._convert_units() # Validate the inputs.
759759

760760
def get_path(self):
@@ -809,6 +809,16 @@ def set_y(self, y):
809809
self._y0 = y
810810
self.stale = True
811811

812+
@property
813+
def angle(self):
814+
"""Rotation angle, degrees anticlockwise about anchor point."""
815+
return self._angle
816+
817+
@angle.setter
818+
def angle(self, angle):
819+
self._angle = angle
820+
self.stale = True
821+
812822
def set_xy(self, xy):
813823
"""
814824
Set the left and bottom coordinates of the rectangle.

0 commit comments

Comments
 (0)