On Sat, Oct 23, 2010 at 7:09 AM, Kynn Jones <kyn...@gmail.com> wrote:
> Without knowing much about the internals of matplotlib, it seems to me that
> the best way to do this would be to define a container class that can have
> itself as one of the contained elements.  In this way, a containment
> hierarchy of arbitrary depth could be defined.  But it is my understanding
> that there is no immediate way to do this in matplotlib now, so I'd have to
> implement it myself.

Matplotlib has a simple hierachy of Figure-Axes-Artists (this is not
100% correct description as a matter of fact, see
http://matplotlib.sourceforge.net/users/artists.html for more
details).

All Axes instances have associated positions within a figure instance.
If you want to have a hierarchy of multiple axes, what you can do
basically is to make those positions in hierarchical manner.

This can be very trivial depending on what exactly you want (e.g., how
you want the axes sizes (and the gaps inbetween) specified). However,
there are a few ways to ease this process.

http://github.com/astraw/mplsizer

mpl v1.0 has gridspec.

http://matplotlib.sourceforge.net/users/gridspec.html#gridspec-using-subplotspec

For example, you may do something like

import matplotlib.gridspec as gridspec
fig = gcf()
gs0 = gridspec.GridSpec(2, 2)
ax = fig.add_subplot(gs0[0, 0])

gs00 = gridspec.GridSpecFromSubplotSpec(2, 2, subplot_spec=gs0[1])
ax2 = fig.add_subplot(gs00[0])

gs000 = gridspec.GridSpecFromSubplotSpec(2, 2, subplot_spec=gs00[1])
ax3 = fig.add_subplot(gs000[0])

Or, you can use axes_grid toolkit as mentioned above.

Regards,

-JJ

------------------------------------------------------------------------------
Nokia and AT&T present the 2010 Calling All Innovators-North America contest
Create new apps & games for the Nokia N8 for consumers in  U.S. and Canada
$10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing
Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store 
http://p.sf.net/sfu/nokia-dev2dev
_______________________________________________
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel

Reply via email to