PolyCollection and transforms

PolyCollection and transforms
I am trying to animate the movement of a polygon and thought a sound approach would be to in a loop where I redraw after altering the offsets value. However I seem to not be able to scale the polygon correctly. Here is an example of only trying to place a polygon (square) at 1,1. You can see the translation is correct, but the scaling is wrong–the polygon is only about a pixel high & wide.

Dave

···

import pylab as P

from matplotlib import collections, axes, transforms

import matplotlib.numerix as N

fig = P.figure()

a = fig.add_subplot(1,1,1)

verts = N.array([[0,0],[1,0],[1,1],[0,1]])

offsets = [[1,1]]

col = collections.PolyCollection([verts], offsets=offsets,

                            transOffset=a.transData)

a.add_collection(col)

trans = transforms.scale_transform(transforms.Value(1),transforms.Value(1))

col.set_transform(trans)

a.set_xlim([-5,5])

a.set_ylim([-5,5])

P.show()