Regarding the use of transforms in Matplotlib, what
> would be the simplest way to convert a quantity
> expressed in data coordinates to points and conversely?
> Are the methods gca().transData.xy_tup() and
> inverse_xy_tup() what I'm looking for? If so, how
> should I be calling them?
I think the easiest way is to transform the data to screen coordinates
and then apply a scale factor to convert pixels to points. All of the
xy_tup(xy) - transform the tuple (x,y)
seq_x_y(x, y) - transform the python sequences x and y
numerix_x_y(x, y) - x and y are numerix 1D arrays
seq_xy_tups(seq) - seq is a sequence of xy tuples
return screen coords. To get points from left, bottom, you would
could convert to inches by dividing by dpi, and then multiply by the
number of points per inch. Untested, off the cuff, but should be
# display coords
dx, dy = trans.xy_tup(x, y)
# points from left of figure window
px = dx/dpi*72
# points from bottom of figure window
py = dy/dpi*72
with the usual caveat that screen dpi is not the same in the x and y
directions so the physical units may not be exact when displayed.