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
BUG: Add subplot spec eq #2597
BUG: Add subplot spec eq #2597
Conversation
This is to address the issue discovered in http://stackoverflow.com/questions/20017314/how-are-existing-subplot-axes-retrieved-using-subplot2grid-gridspec-in-matplotli where multiple calls to gs = gridspec.GridSpec(2, 1) ax1 = fig.add_subplot(gs[0, 0]) ax2 = fig.add_subplot(gs[0, 0]) will return a new axes each time (unlike calls integers or tuples).
And this seems to break all sorts of things and I have no idea why. |
I suspect a lot of these failures can be fixed by putting |
does not have the necessary attributes.
The other way to do this would be to wrap the |
There is sometimes a real need of getting a different axes at the same place: twinx etc. |
Ahh, i see that doable by #2515, than nvm :) |
@tacswell Oh, i maybe i read #2515 too fast. I used the old behavior to make my own twinx with gs, but now it seems it was never necessary. Sorry for the noise. |
@tacaswell - nice easy one to test. If you can add a unit test, I will merge. 👍 |
Added test to check if repeated calls to to `gs[n, m]` are equal.
@pelson test added. |
that it gets run
This is an old bug, but it seems it has not been corrected? I still get a new axes instances instead of referring an existing axes; or am I missing anything? |
@duckrojo what version of mpl are you using? The tests added in this PR are still in the code base (and being run by our CI) Can you provide a MWE of what is broken? |
See: http://stackoverflow.com/questions/20017314/how-are-existing-subplot-axes-retrieved-using-subplot2grid-gridspec-in-matplotli
in short,
which breaks the logic of calling
ax = fig.add_subplot(gs[0,0])
multiple times.