Restore _AxesStack to track a Figure's Axes order.#19625
Conversation
| _api.check_isinstance(Axes, a=a) | ||
|
|
||
| if a in self: | ||
| return None |
There was a problem hiding this comment.
probably should test this since it seems someone could change this?
There was a problem hiding this comment.
I'll check further, but this may not ever happen, as the Figure.add_* might handle that already now.
There was a problem hiding this comment.
There are 3 effects of this early return:
- A different return value, but
_AxesStack.addis only called from_add_axes_internal, and that doesn't care about the return value. - The
Axesdoesn't get added to the stack multiple times, but that's what we want anyway. - The
Axeswould not be made current (i.e., moved to the end), but there's ascain_add_axes_internal, so we don't need to worry about that.
I thought some tests checked add_axes/add_subplot with an existing Axes, but it appears not if this isn't getting coverage. I will add some more tests and remove the return value, which no-one uses.
|
To summarize?
|
ac394fc to
518d064
Compare
| def __getitem__(self, ind): | ||
| return self._elements[ind] | ||
|
|
||
| def as_list(self): |
There was a problem hiding this comment.
Why is this method removed?
There was a problem hiding this comment.
It was moved from _AxesStack to the base class; now that _AxesStack is back, it's not needed there. Better not to add more public API if not necessary.
518d064 to
3817c80
Compare
|
I'll wait until today's meeting to merge in case there are any other issues but I think this is good. |
|
So we can merge now? |
|
yes 😄 |
|
I don't know why meeseeks is randomly not backporting. @meeseeksdev backport to v3.4.x |
…625-on-v3.4.x Backport PR #19625 on branch v3.4.x (Restore _AxesStack to track a Figure's Axes order.)
PR Summary
This is a simplified version of the
AxesStackremoved in #19153, but removing the key entry, and just tracking the index with theAxes. We no longer need to track keys.Fixes #19598.
PR Checklist
pytestpasses).flake8on changed files to check).flake8-docstringsand runflake8 --docstring-convention=all).doc/users/next_whats_new/(follow instructions in README.rst there).doc/api/next_api_changes/(follow instructions in README.rst there).