Repository navigation
Document how to check for the existence of current figure/axes. - #20783
Conversation
|
|
||
| If no current Axes exists, a new one is created using `.add_subplot`. | ||
| (To test whether an Axes exists on a Figure, check whether | ||
| ``figure.axes`` is empty. To test whether a current Figure exists, |
There was a problem hiding this comment.
| ``figure.axes`` is empty. To test whether a current Figure exists, | |
| ``figure.axes`` is empty. To test whether any figures exist, |
I appreciate that you mean a "current figure" as in a figure on the figure stack, but that technical distinction reads strangely, and I don't think needs to be made here. Ditto below....
There was a problem hiding this comment.
I don't have a strong preference, but note that the current wording parallels the first sentence ("if no current Axes exists"). Would you change that too?
There was a problem hiding this comment.
No, because gca stands for "get current axes"....
There was a problem hiding this comment.
But that's the same as gcf() which stands for get current figure?
There was a problem hiding this comment.
This is not the docs for gcf. You could be more technical and say "To test whether there are any figures in the gcf() stack," But the phrase "to test whether a current Figure exists" just reads a typo/bad grammar with no context.
If we want we could change "Get the current Axes from the pyplot Axes stack" to be more explicit as well. (and maybe replace "stack" by something more correct?)
There was a problem hiding this comment.
Ah, I think I see the problem. I pushed a rewording, does that look better?
There was a problem hiding this comment.
looks good to me. This could go in regardless of #20773...
|
|
hopefully fixed now |
PR Summary
This is an alternate approach for #20773, relying only on doc improvements.
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).