moving a patch

By the way: does anybody know how to move a patch in

    > matplotlib? set_data works for lines, but what works for
    > patches?

This should be easier, but here's an example with a regular polygon --
it is quite easy to generalize this to any patch...

Use the blit techniques described on the animation wiki if you want to
make this significantly more efficient

from matplotlib.patches import RegularPolygon
from pylab import figure, show, nx

class MyPoly(RegularPolygon):

    def __init__(self, *args, **kwargs):
        RegularPolygon.__init__(self, *args, **kwargs)
        self.offsetx = 0
        self.offsety = 0
        self.x, self.y = map(nx.array, zip(*RegularPolygon.get_verts(self)))
    def get_verts(self):
        x = self.x + self.offsetx
        y = self.y + self.offsety
        return zip(x, y)
poly = MyPoly(xy=(1,1), numVertices=6, radius=5)

fig = figure()
ax = fig.add_subplot(111, xlim=(-100, 100), ylim=(-100, 100), autoscale_on=False)

def start(event):
    randn = nx.mlab.randn
    for i in range(200):
        poly.offsetx += 2*randn()
        poly.offsety += 2*randn()
start.cid = fig.canvas.mpl_connect('draw_event', start)