I’m animating a Circle patch with a varying center and radius, and I noticed that changing the
radius attribute has no effect on the patch. Currently,
radius is only used to instantiate an Ellipse object, but updating radius has no effect (i.e. redrawing the patch doesn’t use the new radius).
I’ve included a patch to add this feature. Also included in the patch is a small fix to one of the UI examples (sorry for included a completely unrelated patch but the fix seemed to small for a separate email).
BTW, I’m using a property idiom from: http://code.activestate.com/recipes/205183/. I thought that this approach was better than polluting the namespace with getters and setters, especially since this would differ from the way the Ellipse class uses
— lib/matplotlib/patches.py (revision 7128)
+++ lib/matplotlib/patches.py (working copy)
@@ -1131,6 +1131,14 @@
self.radius = radius
Ellipse.init(self, xy, radius2, radius2, **kwargs)
init.doc = cbook.dedent(init.doc) % artist.kwdocd
return self.width / 2.
def fset(self, radius):
self.width = self.height = 2 * radius
radius = property(**radius())
— examples/user_interfaces/embedding_in_wx3.py (revision 7128)
+++ examples/user_interfaces/embedding_in_wx3.py (working copy)
@@ -147,7 +147,7 @@
bang_count = XRCCTRL(self.frame,"bang_count")
bang_count = xrc.XRCCTRL(self.frame,"bang_count")
bangs = bang_count.GetValue()
bangs = int(bangs)+1