From: Axel Kowald <kowald@mo...> - 2004-12-14 16:19:58
I'm new to matplotlib and I have a question regarding axes.
Once I created some axes (either with the axes() command or with
subplot() ), how can I later find out the limits (left bottom, width,
height) of the axes ?
Maybe some trick with get() ?
Btw. is there somewhere a list of properties that I can get/set with
get() or set() ?
From: John Hunter <jdhunter@ac...> - 2004-12-14 19:13:46
>>>>> "Axel" == Axel Kowald <kowald@...> writes:
Axel> Hi, I'm new to matplotlib and I have a question regarding
Axel> axes. Once I created some axes (either with the axes()
Axel> command or with subplot() ), how can I later find out the
Axel> limits (left bottom, width, height) of the axes ? Maybe
7 >>> ax = subplot(111)
8 >>> ax.get_position()
Out: [0.125, 0.10999999999999999, 0.77500000000000002, 0.79000000000000004]
You can change these values with ax.set_position. This works whether
ax is an Axes or Subplot instance.
Axel> some trick with get() ? Btw. is there somewhere a list of
Axel> properties that I can get/set with get() or set() ?
A timely question. This feature was just added in the last release,
>>> set(ax) # lists all settable properties
>>> get(ax) # lists all properties and their values
Works for any matplotlib artist or sequence of artists; see
This is still a work in progress - the introspection works in part by
examining doc strings and I have finished porting all the artist
docstrings to the new format. set(artist) should return a list of all
properties and their legal settable values. If the settable values is
listed as unknown, it means I haven't done that docstring yet.
Also, I'm working on implementing Perry's suggestion of returning
silent lists where appropriate, which will help in pretty printing the
output, eg, of get(ax).
But it's mostly functional, as is.