On Thu, Mar 18, 2010 at 11:47 AM, John Hunter <jdh2...@gmail.com> wrote: > I disagree here -- if you are 2,1 or 1,2 rows x cols, 1D indexing is > natural. This is also the most common use case so the most important > to get right. If you aren't doing multiple subplots, a plain ol > subplot(111) may be preferred to fig_subplots anyhow. >
I agree with John that for nx1 or 1xn, 1-d indexing seems more natural, and is the more pythonic solution given how numpy doesn't distinguish between row and column arrays when they are 1-d, in contrast to matlab. This is why I went for the approach above. Based on the feedback, I'll finish it tonight with squeeze=True as a kwarg, that behaves: - if True (default): single axis is returned as a scalar, Nx1 or 1xN are returned as numpy 1-d arrays, and only NxM with N>1 and M>1 are returned as a 2d array. - if False, no squeezing at all is done, the return value is always a 2-d array, even if it ends up being 1x1. I think this gives a very convenient interactive/lightweight scripting interface, while letting application builders who may need to write generic code that is dimension agnostic have robust code that needs no special-casing by passing squeeze=False. Unless I hear otherwise, I'll make the commit with these changes (updating the docstring and example script accordingly). 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