Take a look at the transformations tutorial.
To convert from data -> pixel coordinates, use the axes transData transformation
In : ax = gca()
In : ax.transData.transform((0.5, 0.5))
Out: array([ 333.125, 245. ])
You can also use mpl events to inspect the coordinates of the point
under the mouse
In : fig = gcf()
In : def on_click(event):
...: print event.x, event.y
In : cid = fig.canvas.mpl_connect('button_press_event', on_click)
In : 188 166.0
In : fig.canvas.mpl_disconnect(cid)
See http://matplotlib.sourceforge.net/users/event_handling.html for more info.
On Wed, Sep 29, 2010 at 4:44 AM, Alexander Dietz <alexanderdietz1@...982...> wrote:
I would like to know how to find out the extend of the actual image in a
plot, in units of pixels.
As example I have attached a plot which is essentially empty. The lower left
corner is indicated by a red dot - what pixel position does this location
have? When opening this image in e.g. kview it is easy to find out that this
left corner of the actual plot corresponds to pixel (100,540). And so the
upper right corner (the yellow dot) is (720,60).
But how do I find out these coordinates when generating such a plot with
matplotlib? Are there some variables of the axis or the actual plot that
contain these numbers?