<div dir="ltr">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<div><br></div><div>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.</div><div><br></div><div>Tom</div></div><br><div class="gmail_quote"><div dir="ltr">On Mon, May 16, 2016 at 2:06 PM Christopher Field <<a href="mailto:christophertfield@gmail.com">christophertfield@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"> 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.<br>
<br>
I found that was often writing<br>
Fig, ax = plt.subplots( N, M, squeeze=False )<br>
ax = ax.flatten() or ax=ax.ravel()<br>
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.<br>
Does providing squeeze with bool or string values violate any rules?<br>
What is the clearest string to use? I have considered ‘flatten’, ‘flat’, ‘ravel’, and ‘1d’.<br>
<br>
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.<br>
<br>
Should I invest the effort required to submit these? Is there a time frame in which these additions would be more or less welcome?<br>
<br>
Thank you,<br>
Christopher Field<br>
<br>
<br>
<br>
_______________________________________________<br>
Matplotlib-devel mailing list<br>
<a href="mailto:Matplotlib-devel@python.org" target="_blank">Matplotlib-devel@python.org</a><br>
<a href="https://mail.python.org/mailman/listinfo/matplotlib-devel" rel="noreferrer" target="_blank">https://mail.python.org/mailman/listinfo/matplotlib-devel</a><br>
</blockquote></div>