8000 DOC: Start to document interactive figures by tacaswell · Pull Request #4779 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content

DOC: Start to document interactive figures #4779

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

Merged
merged 36 commits into from
May 21, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
cfa717a
DOC: Start to document interactive figures
tacaswell Jul 24, 2015
206f99c
DOC: improve text
tacaswell Jul 31, 2015
fa36c95
DOC: address comments
tacaswell Jan 7, 2017
8b28c01
DOC/WIP: updates to docs on how event loops work
tacaswell Jul 28, 2017
7189eed
DOC: add blocking_input docs
tacaswell Dec 28, 2017
98ae26c
WIP: Lots of text changes to interactive guide
tacaswell Dec 28, 2017
6263284
MNT: add warnings to Figure.show
tacaswell Dec 29, 2017
09deda3
DOC: re-arrange shell.rst and interactive.rst
tacaswell Jan 3, 2018
ec4230a
DOC/WIP: more edits and content
tacaswell Jul 10, 2018
d1a7a3e
WIP: more notes
tacaswell Mar 2, 2019
b49973a
DOC: merge the blocking API docs together
tacaswell Apr 28, 2020
bb8058a
DOC: remove rst files that have been merged into interactive.rst
tacaswell Apr 28, 2020
bc4ecd5
DOC: fix and sort intersphinx
tacaswell Apr 28, 2020
49f49fa
DOC: re-write pyplot.show docstring
tacaswell Apr 29, 2020
295d71d
DOC: plt.pause is no longer experimental
tacaswell Apr 29, 2020
c3c5013
DOC: update pyplot documentation
tacaswell Apr 30, 2020
d9df057
DOC: Lots of editing to interactive figure documentation
tacaswell Apr 30, 2020
7b0b327
DOC: it's -> its
tacaswell Apr 30, 2020
5a426d6
DOC: spelling
tacaswell Apr 30, 2020
8ab0a65
DOC: edits from review
tacaswell May 1, 2020
d70d5ad
DOC: update skipped references
tacaswell May 1, 2020
757e040
DOC: correct many spelling / grammer / clarity issues
tacaswell May 3, 2020
b0690ff
DOC: remove badly named and superfluous heading
tacaswell May 7, 2020
cc3ac5b
DOC: address review comments
tacaswell May 7, 2020
afe9edd
DOC: edits from review
tacaswell May 7, 2020
e09cab9
DOC: more small edits
tacaswell May 7, 2020
04f2fc6
DOC: fix spyder spelling
tacaswell May 7, 2020
9d842bf
DOC: edits from review
tacaswell May 7, 2020
41e19a8
MNT: remove unused import
tacaswell May 7, 2020
eda2ed3
DOC: edits from review
tacaswell May 9, 2020
7cf68e8
DOC: remove non-existent function call
tacaswell May 9, 2020
bfa3589
DOC: edits and duplicate removal
tacaswell May 9, 2020
6edcb47
DOC: windows not widows
tacaswell May 9, 2020
9b492bd
DOC: Revert all changes to blocking_input_api.rst
tacaswell May 9, 2020
6d4747f
DOC: reduce jargon and correct grammar
tacaswell May 20, 2020
f05ea3d
DOC: grammar / wording corrections from review
tacaswell May 20, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
DOC: reduce jargon and correct grammar
  • Loading branch information
tacaswell committed May 20, 2020
commit 6d4747f9b6aa9c7c12c83cc447595ee2c2c43db1
38 changes: 24 additions & 14 deletions doc/users/interactive.rst
Original file line number Diff line number Diff line change
Expand Up @@ -146,34 +146,45 @@ Interactive mode controls:

- whether created figures are automatically shown
- whether changes to artists automatically trigger re-drawing existing figures
- whether `.pyplot.show` blocks or not
- whether `.pyplot.show` returns immediately or after all of the
figures have been closed when given no arguments


If in interactive mode, then:

- newly created figures will be shown immediately
- figures will automatically redraw on change
- pyplot.show will not block by default
- pyplot.show will return immediately by default

If not in interactive mode then:

- newly created figures and changes to figures will
not be reflected until explicitly asked to be
- pyplot.show will block by default
- pyplot.show runs the GUI event loop and does not return until all of
the plot windows are closed


If you are in non-interactive mode (or created figures while in
non-interactive mode) you may need to explicitly call `.pyplot.show`
to bring the windows onto your screen. If you only want to run the
GUI event loop for a fixed amount of time you can use `.pyplot.pause`.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

-> "GUI event loop and block for a fixed amount of time..." In the typical (I suspect) use case, the key desired behavior is the blocking, not the interactivity via the GUI event loop.


Being in interactive mode is orthogonal to the GUI event loop being
integrated with your command prompt. If you have the GUI event loop
integrated with your prompt, then shown figures will be "live" while
the prompt is waiting for input, if it is not integrated then your
figures will only be "live" when the GUI event loop is running (via
`.pyplot.show`, `.pyplot.pause`, or explicitly starting the GUI main
loop).
This will both block the progress of your code (as if you had called
`time.sleep`), raise ensure the current window is shown and if needed
re-drawn, and run the GUI event loop (so the windows are "live" for
intrection) for the specified period of time.

Being in "interactive mode" is orthogonal to the GUI event loop being
integrated with your command prompt. If you use `pyplot.ion`, but
have not arrange for the event loop integration your figures will
appear but will not be "live" while the prompt is waiting for input.
You will not be able to pan/zoom and the figure may not even render
(the window might appear black, transparent, or as a snapshot the
desktop under it). Conversely, if you configure the event loop
integration displayed figures will be "live" while waiting for input
at the prompt independent of pyplot's "interactive mode". In either
case, the figures will be "live" if you use
``pyplot.show(block=True)``, `.pyplot.pause`, or run the the GUI main
loop in some other way.


.. warning::
Expand Down Expand Up @@ -276,8 +287,7 @@ If you only need to use the classic notebook you can use
%matplotlib notebook

which uses the `.backend_nbagg` backend which ships with Matplotlib.
However nbagg does not work in Jupyter Lab due to changes in the front
end.
However nbagg does not work in Jupyter Lab.

GUIs + jupyter
~~~~~~~~~~~~~~
Expand All @@ -295,5 +305,5 @@ the figure (if it does not raise an exception outright).
PyCharm, Spyder, and VSCode
---------------------------

Many IDEs have built-in integration with Matplotlib, please consult its
Many IDEs have built-in integration with Matplotlib, please consult their
documentation for configuration details.
14 changes: 7 additions & 7 deletions doc/users/interactive_guide.rst
Original file line number Diff line number Diff line change
Expand Up @@ -75,13 +75,13 @@ Command Prompt Integration
==========================

So far, so good. We have the REPL (like the IPython terminal) that
lets us interactively send things code to the interpreter and get
results back. We also have the GUI toolkit that runs an event loop
waiting for user input and lets us register functions to be run when
that happens. However, if we want to do both we have a problem: the
prompt and the GUI event loop are both infinite loops that each think
*they* are in charge! In order for both the prompt and the GUI windows
to be responsive we need a method to allow the loops to 'timeshare' :
lets us interactively send code to the interpreter and get results
back. We also have the GUI toolkit that runs an event loop waiting
for user input and lets us register functions to be run when that
happens. However, if we want to do both we have a problem: the prompt
and the GUI event loop are both infinite loops that each think *they*
are in charge! In order for both the prompt and the GUI windows to be
responsive we need a method to allow the loops to 'timeshare' :

1. let the GUI main loop block the python process when you want
interactive windows
Expand Down
0