[Matplotlib-devel] Offer of additions to subplots

Thomas Caswell tcaswell at gmail.com
Mon May 16 14:53:44 EDT 2016

We have a number of other cases where we mix types on input.  I have also
wanted `squeeze='flatten'` on a few occasions and am +1 on the first idea

I am a bit more hesitant on the second, it might be crossing the line into
making the API too clever/flexible for its own good.


On Mon, May 16, 2016 at 2:06 PM Christopher Field <
christophertfield at gmail.com> wrote:

>         I love pyplot.subplots and use it to create almost all of my
> graphs. I have implemented code for two subplots enhancements. Because I
> have never contributed to an open source project, I wanted to clear the
> additions before I put in the effort to learn how to make a contribution
> and implement all of the supporting documentation and samples.
>         I found that was often writing
> Fig, ax = plt.subplots( N, M, squeeze=False )
> ax = ax.flatten()         or ax=ax.ravel()
>         My addition provides a squeeze=‘flatten’ option, which always
> returns a 1D numpy array.  This is useful under three situations. First,
> there is a 2D arrangement of plots that are to be populated by indexing in
> a single loop. Second, there is a  1D arrangement of plots of variable
> number which, if squeeze=True, might return a single axis or a numpy array.
> Third, there is a 2D arrangement of plots that you wish to access with a
> single subscript.
>         Does providing squeeze with bool or string values violate any
> rules?
>         What is the clearest string to use? I have considered ‘flatten’,
> ‘flat’, ‘ravel’, and ‘1d’.
>         The second enhancement permits sharing axis between different
> figures. It extends the sharex and sharey arguments to accept either an
> axis instance (in which case all of the new plots share the same x or y
> limits), or 1D or 2D numpy arrays of axis instances (in which case
> rows/columns are shared or each plot shares with the corresponding plot
> passed in.
>         Should I invest the effort required to submit these? Is there a
> time frame in which these additions would be more or less welcome?
> Thank you,
> Christopher Field
> _______________________________________________
> Matplotlib-devel mailing list
> Matplotlib-devel at python.org
> https://mail.python.org/mailman/listinfo/matplotlib-devel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/matplotlib-devel/attachments/20160516/c0f6297f/attachment.html>

More information about the Matplotlib-devel mailing list