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

Skip to content

Commit 868719e

Browse files
committed
modified Tony's patch to coimply w/ mpl properties
svn path=/trunk/matplotlib/; revision=7133
1 parent 8dda8ba commit 868719e

File tree

1 file changed

+17
-11
lines changed

1 file changed

+17
-11
lines changed

lib/matplotlib/patches.py

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1131,14 +1131,20 @@ def __init__(self, xy, radius=5, **kwargs):
11311131
self.radius = radius
11321132
Ellipse.__init__(self, xy, radius*2, radius*2, **kwargs)
11331133
__init__.__doc__ = cbook.dedent(__init__.__doc__) % artist.kwdocd
1134-
1135-
def radius():
1136-
def fget(self):
1137-
return self.width / 2.
1138-
def fset(self, radius):
1139-
self.width = self.height = 2 * radius
1140-
return locals()
1141-
radius = property(**radius())
1134+
1135+
def set_radius(self, radius):
1136+
"""
1137+
Set the radius of the circle
1138+
1139+
ACCEPTS: float
1140+
"""
1141+
self.width = self.height = 2 * radius
1142+
1143+
def get_radius(self):
1144+
'return the radius of the circle'
1145+
return self.width / 2.
1146+
1147+
radius = property(get_radius, set_radius)
11421148

11431149
class Arc(Ellipse):
11441150
"""
@@ -2589,7 +2595,7 @@ def __init__(self, armA=0., armB=0., fraction=0.3, angle=None):
25892595
def connect(self, posA, posB):
25902596
x1, y1 = posA
25912597
x20, y20 = x2, y2 = posB
2592-
2598+
25932599
x12, y12 = (x1 + x2)/2., (y1 + y2)/2.
25942600

25952601
theta1 = math.atan2(y2-y1, x2-x1)
@@ -2598,7 +2604,7 @@ def connect(self, posA, posB):
25982604
ddx, ddy = dx/dd, dy/dd
25992605

26002606
armA, armB = self.armA, self.armB
2601-
2607+
26022608
if self.angle is not None:
26032609
#angle = self.angle % 180.
26042610
#if angle < 0. or angle > 180.:
@@ -2622,7 +2628,7 @@ def connect(self, posA, posB):
26222628

26232629
else:
26242630
dl = 0.
2625-
2631+
26262632
#if armA > armB:
26272633
# armB = armA + dl
26282634
#else:

0 commit comments

Comments
 (0)