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()

------------------------------------------------------------------------
----------


-------------------------------------------------------------------------
SF.Net email is sponsored by: The Future of Linux Business White Paper
from Novell.  From the desktop to the data center, Linux is going
mainstream.  Let it simplify your IT future.
http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to