Howdy,

On Wed, Feb 24, 2010 at 11:27 AM, Fernando Perez <fperez....@gmail.com> wrote:
> OK, since I know people are busy, I took silence as acquiescence.
> Committed in r8151, please let me know if I messed anything up and
> I'll try to fix it.  I'm used to the numpy docstring standard, but I
> tried to adapt it to the mpl  one by looking at the rest of pyplot,
> let me know if  it needs fine-tuning.

While chatting today with John, he suggested that a better api for
this would be to return an *array* of supblots, so that  one could
index them with a[i,j] for the plot in row i, column j.  I've
implemented this already, but before committing it, I have one doubt:
what to do when nrows==ncols==1, the single subplot case? I'm inclined
to return only the subplot instead of a one-element array, so that one
can say

f, a = fig_subplot()
a.plot(...)

instead of having to do

f, a = fig_subplot()
a[0].plot(...)

But this means the return value of the function would be:
- fig, axis if nr=nc=1
- fig, axis_array in all other cases.

so it's a bit ugly.  I think this is a case where practicality beats
purity and my nose tells me to go for the less pretty but more
convenient api, but I'm happy to get feedback.  The return code reads
currently:

    # Reshape the array to have the final desired dimension (nrow,ncol), though
    # discarding unneeded dimensions that equal 1.  If we only have one
    # subplot, just return it instead of a 1-element array.
    if nplots==1:
        return fig, axarr[0]
    else:
        return fig, axarr.reshape(nrows, ncols).squeeze()


Once we settle this design decision, I'll  update the docstring and
example and will post the patch for final review before committing.

Cheers,

f

------------------------------------------------------------------------------
Download Intel&#174; 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

Reply via email to