On Thu, Nov 5, 2009 at 2:31 PM, Thomas Robitaille
<thomas.robitai...@gmail.com> wrote:
> Is there an easy way to add axes to a figure, but specify the 'rect'
> in real rather than relative units? For example, something like:
>

unfortunately no. And I'm not sure if matplotlib will ever going to
support it internally.

However, converting axes coordinates given in inches to the normalized
figure coordinates is not that difficult. And this will work as far as
the figure size does not change after the axes position is calculated
in the normalized figure coordinates.

fig = figure(1)

rect_inches = 0.5, 0.5, 3., 3.

from matplotlib.transforms import Bbox, BboxTransformFrom, TransformedBbox
tr = BboxTransformFrom(Bbox.from_bounds(0, 0, *fig.get_size_inches()))
rect = TransformedBbox(Bbox.from_bounds(*rect_inches), tr).bounds

ax = fig.add_axes(rect)

Note that the axes coordinate need to be recalculated whenever the
figure size changes.

While the axes_grid toolkit has some limited support for fixed size
(in inches) axes, I personally never find it useful.

http://matplotlib.sourceforge.net/examples/axes_grid/demo_fixed_size_axes.html

-JJ

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to