Thanks for your reply ! The thread you pointed me to, was useful, though I
didnt uderstand everything in it yet.
However, I found that the following works for what I want ... though it does
what I want, am I making some horrible mistake which will come around and
haunt me later ?
plsub = subplot(1,1,1)
plaxis = axis([0, n 0, m])
start = plsub._position.p0
stop = plsub._position.p1
plsub._position.p0 and p1 store the normalised coordinates of the subplot
box, it seems, which is what I need for now.
On Wed, Apr 1, 2009 at 7:54 PM, Jae-Joon Lee <lee.j.joon@...> wrote:
> This thread might be helpful.
> Take a look at the above thread and see if it fits your need.
> However, it became tricky if your axes adjust its position (e.g.,
> aspect=1) during the drawing time.
> The example below will be helpful in those case (you need recent
> version of matplotlib for this, see if your axes has
> "set_axes_locator" method), but this requires some knowledge on how
> mpl works.
> import matplotlib.transforms
> class InsetPosition(object):
> def __init__(self, parent, lbwh):
> self.parent = parent
> self.lbwh = lbwh # position of the inset axes in the
> normalized coordinate of the parent axes
> def __call__(self, ax, renderer):
> bbox_parent = self.parent.get_position(original=False)
> trans = matplotlib.transforms.BboxTransformTo(bbox_parent)
> bbox_inset = matplotlib.transforms.Bbox.from_bounds(*self.lbwh)
> bb = matplotlib.transforms.TransformedBbox(bbox_inset, trans)
> return bb
> ax = gca()
> axins = axes([0, 0, 1, 1])
> ip = InsetPosition(ax, [0.5, 0.1, 0.4, 0.2])
> On Wed, Apr 1, 2009 at 8:22 AM, oyarsa the old <oyarsa42@...> wrote:
> > Hello,
> > I am new to matplotlib and pylab.
> > I have an image plotted with imshow/contour, or even just a coordinate
> > system plotted with axis.
> > I need to plot smaller contours/images on them at selected pixels. The
> > way I can figure how to do that is using axes. However, axes is defined
> > normalised coordinates which cover the entire window, whereas the axis of
> > the main figure is drawn within it, with some margin.
> > My problem is how to get the correct coordinates for plotting each of the
> > smaller figures ? The easiest way to do so would be to get the normalised
> > coordinates of the rectangle which is drawn by axis. Is there a way to
> > that?
> > Thanks
> > Mohan.
> > _______________________________________________
> > Matplotlib-users mailing list
> > Matplotlib-users@...
> > https://lists.sourceforge.net/lists/listinfo/matplotlib-users