On Thu, Mar 18, 2010 at 12:20 PM, Eric Firing <efir...@hawaii.edu> wrote:
> Fernando Perez wrote:
>> 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.
>
> The behavior one wants depends on whether one is calling fig_subplot in
> a program in which the number of subplots could range from 0 to n, or
> whether the call is being made with the number of subplots hardwired.
> The latter may be most common, but the former seems like an important
> use case.  I suggest providing a kwarg, e.g. "squeeze=True" as the
> default, to eliminate zero-size-dimensions from the array, and False for
> the case where nrows and/or ncols could be zero but one wants to be able
> to iterate over the resulting array regardless.

+1 This feels like a clean solution to the problem.

Ryan

-- 
Ryan May
Graduate Research Assistant
School of Meteorology
University of Oklahoma

------------------------------------------------------------------------------
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