get_position vs set_position

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

Hi Robin,

What version of matplotlib do you use?

For me the following works:

ax.set_position(ax.get_position())

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