On Tue, Feb 16, 2010 at 10:54 AM, John Jameson <jjame...@altoresearch.com> wrote: > Hi John, > > Thanks for your help on the animation with patches, and now > I'm trying to do the same idea for matplotlib.patches.Polygon > ala your method for a circle patch: > > initialize: > xy =[[x0,y0],[x1,y1],[x2,y2]] > poly = Polygon( xy, animated=True,lw=2,fill=False ) > add_patch(poly) > . > . > in the loop: > poly.set_xy = xy_new > poly.update_transorm() (no such routine) > > > The set_xy seems to work (at least no errors), but I don't see how > to "update the transform" as for the circle.
Two problems here : * There is no polygon attribute "set_xy"; it is a method, so you need to call it like "poly.set_xy(xy_new)". In general this is True for all matplotlib set_* methods. There is also an "xy" attribute which you can access like "poly.xy = xy_new". These two approaches do the same thing * The _update_transforms call was a hack I did on CirclePolygon to work around a broken method. it is not a method of Polygon or Patch which is why you are not finding it. For normal usage, the methods that start with underscores are not meant to be called or used at the user level, but because there was breakage in the CirclePolygon set_xy method, I had to hack around it in the example I posted for you. For Polygon, simply setting the xy attribute should be sufficient. JDH ------------------------------------------------------------------------------ SOLARIS 10 is the OS for Data Centers - provides features such as DTrace, Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW http://p.sf.net/sfu/solaris-dev2dev _______________________________________________ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users