Here's a reference talking about the different coordinate

> systems accessible in matplotlib:

> http://www.scipy.org/Cookbook/Matplotlib/Transformations

> I think what we need is to set the coordinate transform to

> be in and absolute, instead of relative, coordinate

> system, or to build one ourselves. But I don't know

> enough about matplotlib's internals to know if this is

> right. Comments?

This is probably what you want to do. You want to define your arrow

in something like points, then do a rotation, and then apply one of

the transformation offsets to place your arrow at an x,y location.

Note there is a bug in some version of matplotlib in the affine code

which is fixes in SVN -- this arrow should have it's base at 0.5, 0.5

and be pointing NW and measure 2 inches from base to tip. The arrow

size is independent of zoom and figure window size, which may or may

not be desirable....

from matplotlib.transforms import Affine, Value, zero

from matplotlib.patches import Polygon

from pylab import figure, show, nx

fig = figure()

ax = fig.add_subplot(111, xlim=(0,1), ylim=(0,1), autoscale_on=False)

sx = 144/72.*fig.dpi.get() # 2 inches

sy = 144/72.*fig.dpi.get()

theta = 45*nx.pi/180.

# arrow drawn in pixels

trans = Affine(

Value(sx*nx.cos(theta)),

Value(sx*nx.sin(theta)),

Value(-sy*nx.sin(theta)),

Value(sy*nx.cos(theta)),

zero(),

zero())

verts = [

(-0.05,0.75),

(0, 1.),

(0.05,0.75),

(0.05,0),

(-0.05,0),

]

# offset in data coords

trans.set_offset((0.5, 0.5), ax.transData)

poly = Polygon(verts, transform=trans)

ax.add_patch(poly)

show()