Skip to content

Commit e31863d

Browse files
committed
Merge pull request #3112 from tacaswell/wedge_radius_fix
BUG : patches.Wedge.set_radius set wrong attribute
2 parents fa86275 + 4890ea2 commit e31863d

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

lib/matplotlib/patches.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -998,7 +998,7 @@ def set_center(self, center):
998998

999999
def set_radius(self, radius):
10001000
self._path = None
1001-
self.radius = radius
1001+
self.r = radius
10021002

10031003
def set_theta1(self, theta1):
10041004
self._path = None

lib/matplotlib/tests/test_patches.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
import numpy as np
1010
from numpy.testing import assert_array_equal
11+
from numpy.testing import assert_equal
1112
from numpy.testing import assert_almost_equal
1213

1314
from matplotlib.patches import Polygon
@@ -202,6 +203,21 @@ def test_patch_custom_linestyle():
202203
ax.set_ylim([-1, 2])
203204

204205

206+
def test_wedge_movement():
207+
param_dict = {'center': ((0, 0), (1, 1), 'set_center'),
208+
'r': (5, 8, 'set_radius'),
209+
'width': (2, 3, 'set_width'),
210+
'theta1': (0, 30, 'set_theta1'),
211+
'theta2': (45, 50, 'set_theta2')}
212+
213+
init_args = dict((k, v[0]) for (k, v) in six.iteritems(param_dict))
214+
215+
w = mpatches.Wedge(**init_args)
216+
for attr, (old_v, new_v, func) in six.iteritems(param_dict):
217+
assert_equal(getattr(w, attr), old_v)
218+
getattr(w, func)(new_v)
219+
assert_equal(getattr(w, attr), new_v)
220+
205221
if __name__ == '__main__':
206222
import nose
207223
nose.runmodule(argv=['-s', '--with-doctest'], exit=False)

0 commit comments

Comments
 (0)