Removed idiomatic constructs from interactive figures docs#17471
Removed idiomatic constructs from interactive figures docs#17471QuLogic merged 6 commits intomatplotlib:masterfrom
Conversation
dstansby
left a comment
There was a problem hiding this comment.
One minor suggestion, but these all look like good improvements
tacaswell
left a comment
There was a problem hiding this comment.
I agree with most of the wording changes, but some of the changes make the text less accurate.
doc/users/interactive.rst
Outdated
| - pyplot.show runs the GUI event loop and does not return until all of | ||
| the plot windows are closed | ||
| - newly created figures and changes to figures are not displayed until | ||
| `.pyplot.show` is called again or `.pyplot.pause` exits |
There was a problem hiding this comment.
The updates will only happen while show or pause are blocking and well cease after they return. You can also get an update by calling fig.canvas.flush_events or by manually running the event loop.
Additionally, when not in interactive mode the stale hook is turned off so mutating the figure does not trigger draw_idle.
There was a problem hiding this comment.
I'm so unclear about what you're getting at here/how these suggestions translate into user facing docs.
doc/users/interactive.rst
Outdated
| - whether `.pyplot.show` returns immediately or after all of the | ||
| figures have been closed when given no arguments | ||
|
|
||
| - when `.pyplot.show` exits: immediately, or after all of the figures have been closed if given no arguments |
There was a problem hiding this comment.
I think that "returns" is the correct language here. Processes exit, functions return.
There was a problem hiding this comment.
I hate both and think neither is super clear, especially here where it's not super clear that pyplot.show is being talked about in the context of it being a function.
There was a problem hiding this comment.
"exits" is definitely incorrect for a function. Perhaps pyplot.show() (with parentheses) would make things clearer?
doc/users/interactive.rst
Outdated
| loop in some other way. | ||
| at the prompt, regardless of pyplot's "interactive mode". | ||
|
|
||
| The figures will also be "live" if you use ``pyplot.show(block=True)``, |
There was a problem hiding this comment.
| The figures will also be "live" if you use ``pyplot.show(block=True)``, | |
| It any case the figures will be "live" if you use ``pyplot.show(block=True)``, |
There was a problem hiding this comment.
in any case is an ambigious reference 'cause it's not clear what the cases are ...
doc/users/interactive.rst
Outdated
| :ref:`key bindings <key-event-handling>`: | ||
|
|
||
| `.pyplot.figure` | ||
| * `.pyplot.figure` |
There was a problem hiding this comment.
I would prefer to leave these as definition lists rather than bullet points.
doc/users/interactive.rst
Outdated
| <https://github.com/matplotlib/ipympl>`__. For the figures to be | ||
| "live" the GUI event loop will need to be integrated with your prompt. The | ||
| simplest way is to use IPython (see :ref:`below <ipython-pylab>`). | ||
| <https://github.com/matplotlib/ipympl>`__. For the figures to be interactive, |
There was a problem hiding this comment.
I use "live" here to try and disambiguate it from the several other meanings of the word "interactive".
There was a problem hiding this comment.
"live" needs to be defined on first usage - I try to do it a little later but I can pull it up here.
|
|
||
| :: | ||
|
|
||
| user@machine:~ $ ipython |
There was a problem hiding this comment.
I think it is helpful to identify that we are in an IPython session, we should not assume that our readers well recognize the prompt as IPython from the style.
There was a problem hiding this comment.
We say that it's IPython in the narrative, but I'm fine putting this line back in. I just don't want them getting tripped up on all the details of your particular Ipython install
doc/users/interactive.rst
Outdated
|
|
||
| which uses the `.backend_nbagg` backend which ships with Matplotlib. | ||
| However nbagg does not work in Jupyter Lab. | ||
| which uses the `.backend_nbagg` backend which is installed by Matplotlib; |
There was a problem hiding this comment.
| which uses the `.backend_nbagg` backend which is installed by Matplotlib; | |
| which uses the `.backend_nbagg` backend which part of Matplotlib; |
"is installed by" implies it is an external package that we depend on which it is a first-party backend.
doc/users/interactive.rst
Outdated
| appropriate. | ||
|
|
||
| Matplotlib keeps a reference to all of the open figures | ||
| created this way so they will not be garbage collected. You can close |
There was a problem hiding this comment.
Looking at this again, "this way" previously had (when this was one paragraph) some tie in to the 'Current Figure'/'Current Axes' textually, but it doesn't actually in code. So I think this line needs a clarification of what 'this way' is, or this paragraph needs to go before the paragraph on 'current'-ness.
doc/users/interactive.rst
Outdated
| - pyplot.show will return immediately by default | ||
| - newly created figures will be displayed immediately | ||
| - figures will automatically redraw when elements are changed | ||
| - `pyplot.show` displays the figures and immediately returns to the prompt |
There was a problem hiding this comment.
That assumes you're in a prompt...
Though in a script, if plt.ion() is called, then plt.show() immediately returns, and your script exits because nothing is running, so I guess you do end up at a prompt eventually (just not Python's).
There was a problem hiding this comment.
Yeah, this is my frustration w/ the plt.show() docs - they kind of assume a prompt too and it's really unclear.
There was a problem hiding this comment.
Not really? It just says show won't return, and nothing about prompts.
There was a problem hiding this comment.
First line of the show docs:
When running in ipython with its pylab mode, display all figures and return to the ipython prompt
And the rest of the docs use the language of blocking but don't saw what's being blocked.
There was a problem hiding this comment.
That is no longer the first line of show() docs.
doc/users/interactive.rst
Outdated
| loop in some other way. | ||
| at the prompt, regardless of pyplot's "interactive mode". | ||
|
|
||
| The figures will also be "live" if you use ``pyplot.show(block=True)``, |
doc/users/interactive.rst
Outdated
|
|
||
| which uses the `.backend_nbagg` backend which ships with Matplotlib. | ||
| However nbagg does not work in Jupyter Lab. | ||
| which uses the `.backend_nbagg` backend which is installed by Matplotlib; |
doc/users/interactive.rst
Outdated
|
|
||
| it will be reflected immediately. If you wish to disable this behavior | ||
| use | ||
| If you wish to disable interactive modification of the plot: |
There was a problem hiding this comment.
It is the automatic re-draw that is disabled, if you have a prompt you can always interactively modify it (even with out the event loop integration), the user then has to intentionally trigger re-draws or spin the event loop.
There was a problem hiding this comment.
I'm using interactive modification == automatic redraw, but will clarify that
|
Getting this sorted should not block tagging the RC. |
|
folks are welcome to squash merge this |
Co-authored-by: Thomas A Caswell <tcaswell@gmail.com> Co-authored-by: David Stansby <dstansby@gmail.com> Co-authored-by: Elliott Sales de Andrade <quantum.analyst@gmail.com>
Kind of a followup to #4779,