-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
plt.subplots for already existing Figure #5139
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
You can use gridspec + a for loop to do this. |
I can see the point in this, but I feel that it goes against what we have On Fri, Sep 25, 2015 at 8:47 AM, Thomas A Caswell notifications@github.com
|
I know about GridSpec, it is just a bit awkward to use especially when you also want to use share{x,y}. |
Actually, moving the |
On consideration, I now agree this is a good idea. This should be a pretty strait forward copy-paste job, @anntzer want to take a crack at it? |
Also simplify the implementation a bit. cf. matplotlib#5139.
I intended to name the new method |
I can see arguments either way, but overall I agree with @tacaswell. It's shorter. Also, unlike |
Sure, I'll change that. The other question was whether |
I don't know. @tacaswell, if |
My main reason for wanting to call On the other hand, the reason to not call |
On 2015/09/26 3:56 PM, Thomas A Caswell wrote:
This is a real mis-feature. We need to get rid of it ASAP, which |
it also turns out that it (for what ever reason) does not do that in this case and just keeps layering new axes on. |
Was this added to the package? |
Yes, but it is currently on the master branch and not in a released version of the library. |
The
plt.subplots
function in very practical for creating a large number of axes simultaneously, but (afaict) always puts them on a new figure, which is impractical e.g. when embedding matplotlib in a GUI, where a Figure object may be created early on and then populated with some axes later.I would thus suggest providing the same functionality to already existing Figure objects, e.g. by moving the implementation of
plt.subplots
to aFigure.add_subplots
(orFigure.set_subplots
, as it may make sense to clear the figure before) method, and have theplt.subplots
function be a thin wrapper that creates the Figure and then calls itsadd_subplots
method.The text was updated successfully, but these errors were encountered: