Hi Robin,

On Wednesday 08 July 2009 18:48:04 Robin wrote:
> On Wed, Jul 8, 2009 at 4:00 PM, Matthias Michler<matthiasmich...@gmx.net> 
wrote:
> > What version of matplotlib do you use?
>
> I think I am up to date.
>
> > For me the following works:
> >
> > ax.set_position(ax.get_position())
>
> That works for me to - the problem is I wanted to change the numbers a
> little once I saw them. I see now the thing to do (I think) is
> print ax.get_position() # have a look
> from matplotlib.transforms import Bbox
> ax.set_position(Bbox([ [a, b], [c, d] ])) # with numbers changed
> slightly from the printed ones
>
> At the time I thought Bbox was a more internal thing so wanted a way
> to convert Bbox to the format described in the docstring ([left,
> bottom, width, height]). I think it would be nice if Bbox had some
> method to give this (is Bbox.to_pos() ) or something... perhaps there
> already is but I couldn't find it.
In the docstring of set_position it is also mentioned that a Bbox can be given 
as pos.

Just one additional remark: You can also modify the returned Bbox and pass it 
in again into set_position - something like

bb = ax.get_position()
# get an array holding the points:
a = bb.get_points()
# ...  modify a ...
bb.set_points(a)
ax.set_position(bb)

best regards Matthias

> Anyway now I learned Bbox I think it is actually a nicer way to think
> about when doing it by hand (bottom left corner, top right corner).
>
> Thanks for your help,
>
> Robin
>
> > The object returned by get_position is "A mutable bounding box.", which
> > is also supported in set_position. Nevertheless set_position supports
> > lists with '[left, bottom, width, height]', too. E.g.
> > ax.set_position([0.2, .4, 0.4, .5])
> >
> > best regards Matthias
> >
> > On Wednesday 08 July 2009 16:10:37 Robin wrote:
> >> Hi,
> >>
> >> After quite a bit of trial and error I realised that ax.get_position()
> >> is returning numbers in the form a Bbox which are very different to
> >> the numbers you need for ax.set_position().
> >>
> >> Often I want to use the subplot positioning first, then get the
> >> positions that sets up for some manual tweaking. Is there a way to
> >> convert the output of get_position into the same form as for
> >> set_position?
> >>
> >> Cheers
> >>
> >> Robin

------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to