|
View:
New views
2 Messages
—
Rating Filter:
Alert me
|
|
|
add_axes in inchesHi,
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: fig.add_axes([0.5,0.5,3.,3.], inches=True) This would guarantee that for example if I want to increase the canvas size to add more subplots, I don't have to re-adjust all the existing axes. Also, it makes it easier to figure out the aspect ratio of axes, without having to worry about the canvas size. Is there a way to do this already, or is the easiest way to write a wrapper for add_axes that uses the canvas size from fig? Cheers, Thomas ------------------------------------------------------------------------------ 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@... https://lists.sourceforge.net/lists/listinfo/matplotlib-users |
|
|
Re: add_axes in inchesOn Thu, Nov 5, 2009 at 2:31 PM, Thomas Robitaille
<thomas.robitaille@...> 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@... https://lists.sourceforge.net/lists/listinfo/matplotlib-users |
| Free embeddable forum powered by Nabble | Forum Help |