I understand your point but I think that to draw on object
> inside a figure, using some relative coordinate are not
> very convenient. You add to play with the data coordinates
> and the figures coordinates. That can be useful for some
> objects but very often some people would like to plot a
> rectangle (or what do you want) with the data corrdinate
> and it's very disturbing at the beginning the way that
> patches is working. I don't know if I'm clear this time
> (my english is very poor sometimes).
Yes, apparently there is something of a language barrier -- my french
is not so good either, sigh.
But I just want to reiterate, you are not using relative coords for
the rectangle in the example below. When you do the following,
from pylab import *
from matplotlib.patches import Rectangle
ax = gca()
p = Rectangle((1,1),3,3,fill=False)
your rectangle is in *data coordinates* and it is where it should be
(center at 1,1 and width=height=3). The problem is that your axis
"view" limits are not set properly (if you use the pan and zoom
features of the toolbar to move your view limits you'll see the
rectangle where it should be. Only the plot commands (plot, scatter,
etc,....) call autoscale_view to set the view limits (add_patch does
not), so you need to set the axis limits yourself.
In summary, the rectangle is being added in the right coordinate
system (data coords) but the view limits are not automatically
autoscaled unless you issue a plot command. I choose not to do
autoscale every time a patch is added for performance reasons -- if
you are savvy enough to call add_patch, I assume you are savvy enough
to call set_xlim or set_ylim as appropriate for your data.