@@ -1414,7 +1414,7 @@ class Ellipse(Patch):
1414
1414
A scale-free ellipse.
1415
1415
"""
1416
1416
def __str__ (self ):
1417
- pars = (self .center [0 ], self .center [1 ],
1417
+ pars = (self ._center [0 ], self ._center [1 ],
1418
1418
self .width , self .height , self .angle )
1419
1419
fmt = "Ellipse(xy=(%s, %s), width=%s, height=%s, angle=%s)"
1420
1420
return fmt % pars
@@ -1439,7 +1439,7 @@ def __init__(self, xy, width, height, angle=0.0, **kwargs):
1439
1439
"""
1440
1440
Patch .__init__ (self , ** kwargs )
1441
1441
1442
- self .center = xy
1442
+ self ._center = xy
1443
1443
self .width , self .height = width , height
1444
1444
self .angle = angle
1445
1445
self ._path = Path .unit_circle ()
@@ -1452,8 +1452,8 @@ def _recompute_transform(self):
1452
1452
makes it very important to call the accessor method and
1453
1453
not directly access the transformation member variable.
1454
1454
"""
1455
- center = (self .convert_xunits (self .center [0 ]),
1456
- self .convert_yunits (self .center [1 ]))
1455
+ center = (self .convert_xunits (self ._center [0 ]),
1456
+ self .convert_yunits (self ._center [1 ]))
1457
1457
width = self .convert_xunits (self .width )
1458
1458
height = self .convert_yunits (self .height )
1459
1459
self ._patch_transform = transforms .Affine2D () \
@@ -1471,6 +1471,23 @@ def get_patch_transform(self):
1471
1471
self ._recompute_transform ()
1472
1472
return self ._patch_transform
1473
1473
1474
+ def set_center (self , xy ):
1475
+ """
1476
+ Set the center of the ellipse
1477
+
1478
+ ACCEPTS: (x, y)
1479
+ """
1480
+ self ._center = xy
1481
+ self .stale = True
1482
+
1483
+ def get_center (self ):
1484
+ """
1485
+ Return the center of the ellipse
1486
+ """
1487
+ return self ._center
1488
+
1489
+ center = property (get_center , set_center )
1490
+
1474
1491
1475
1492
class Circle (Ellipse ):
1476
1493
"""
@@ -1506,7 +1523,9 @@ def set_radius(self, radius):
1506
1523
self .stale = True
1507
1524
1508
1525
def get_radius (self ):
1509
- 'return the radius of the circle'
1526
+ """
1527
+ Return the radius of the circle
1528
+ """
1510
1529
return self .width / 2.
1511
1530
1512
1531
radius = property (get_radius , set_radius )
0 commit comments