Here is my modification.

    Bbox = matplotlib.transforms.Bbox.from_bounds(.4, .1, .5, .3)
    trans = ax.transAxes + fig.transFigure.inverted()
    l, b, w, h = matplotlib.transforms.TransformedBbox(Bbox, trans).bounds
    axins = fig.add_axes([l, b, w, h])


On Mon, Feb 23, 2009 at 2:49 PM, Johann Rohwer <j...@sun.ac.za> wrote:
> Johann Rohwer wrote:
>
> To answer my own question, after browsing the docstrings I came up with the
> following attached minimal script to illustrate a solution to the problem.
> However, it appears crufty. Specifically,
>
> 1. Can the fig.add_axes() call not take a transform directly as optional
> argument, like in fig.add_axes([.4, .1, .5, .3], transform=ax.transAxes)?
> This would appear the natural solution but does not work.
>

The axes position should be given in the normalized figure coordinates.

> 2. The transformed bounding box gives coordinates in points, necessitating
> the division by figure width and figure height to revert back to fractional
> coordinates.

With my modification, you don't need this anymore.

>
> 3. Re-calculating [l, b, w, h] from tBbox seems cumbersome. Can the
> add_axes() not call a Bbox instance directly?

Also see my modification.
I'm sorry but I don't understand what you mean by "add_axes() not call
a Bbox instance directly?".

IHTH,

-JJ

>
> I'm sure I'm missing something obvious but don't have the time to delve into
> the transforms sourcecode, so any pointer is appreciated :-)
>
> Johann
>
>
> ------------------------------------------------------------------------------
> Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
> -OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
> -Strategies to boost innovation and cut costs with open source participation
> -Receive a $600 discount off the registration fee with the source code: SFAD
> http://p.sf.net/sfu/XcvMzF8H
> _______________________________________________
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>

------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to