On Wed, Feb 17, 2010 at 10:17 PM, John Hunter <jdh2...@gmail.com> wrote: > I think the name "figsubplots" or "fig_subplots" is better because you > are creating Subplot instances. Alternatively, you might want to > consider simply "subplots" which returns just the list of subplots: > the figure can always be accessed as an attribute of the Subplot > instance:: > > ax1, ax2, ax2, ax4 = subplots(2,2) > fig = ax1.figure > > Not sure that this is better; just a thought.
Mmh, even I didn't know that, so I doubt my students would :) Idle thought: we've inherited the ugly 1-offset numbering scheme for subplots from matlab, how about making fig_subplots return [fig, ax1, ax2, ...] This would at least make it easier to remember indexing, since axN == ax[N] would be true. It would also help with the shareax below, see rest of message... >> Should it go into pyplot directly, or elsewhere and imported from >> pyplot to expose it at the top-level? (I'm not overly familiar with >> the layout of the whole library). > > pyplots is the right place for it since it is implicitly creating a > current figure and the only place where that magic happens is in > pyplot. OK. >> I'm also trying to show my students how *they* can improve their >> tools; e.g. earlier this week a homework problem I wrote up led me to >> a useful sympy patch that was quickly upstreamed: > > This is a worthy goal. One use case I would like to see supported > is the sharex/sharey args:: Sheesh, some people really want everything :) > ax1 = fig.add_subplot(211) > ax2 = fig.add_subplot(212, sharex=ax1) [...] > Perhaps the solution to my sharex conundrum is to support an axes number, eg > > ax1, ax2, ax3, ax4 = subplots(4,1, sharex=1) > > so all the subplots would have sharex with ax1. That was what I had in mind, I just hadn't had time to try it. Here it goes (since I started this while preparing class exercises, it's now in the class git repo): http://gfif.udea.edu.co/idf/indefero/www/index.php/p/mscomp-2010/source/tree/master/0217/figsubp.py Comment away, I'll polish it later for mpl over svn, while waiting for us to catch up with the XXth century and move over to git :) There are examples to try it out and see how it works (download link at the bottom of that page). Cheers, f ------------------------------------------------------------------------------ Download Intel® Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev _______________________________________________ Matplotlib-devel mailing list Matplotlib-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-devel