Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Removed idiomatic constructs from interactive figures docs#17471

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
QuLogic merged 6 commits intomatplotlib:masterfromstory645:interactivity
Jun 16, 2020

Conversation

story645
Copy link
Member

Kind of a followup to#4779,

  • stripped out some idiomatic language
  • cleaned up Jupyter capitalization
  • put the descriptions before the code in the code snippets (my docs don't build so I don't know if it renders the snippets...),
  • reworded some things to hopefully be clearer

Copy link
Member

@dstansbydstansby left a comment

Choose a reason for hiding this comment

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

One minor suggestion, but these all look like good improvements

tacaswell
tacaswell previously requested changesMay 21, 2020
Copy link
Member

@tacaswelltacaswell left a comment

Choose a reason for hiding this comment

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

I agree with most of the wording changes, but some of the changes make the text less accurate.

- 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
Copy link
Member

Choose a reason for hiding this comment

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

The updates will only happen whileshow orpause are blocking and well cease after they return. You can also get an update by callingfig.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 triggerdraw_idle.

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

I'm so unclear about what you're getting at here/how these suggestions translate into user facing docs.

- 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
Copy link
Member

Choose a reason for hiding this comment

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

I think that "returns" is the correct language here. Processes exit, functions return.

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

I hate both and think neither is super clear, especially here where it's not super clear thatpyplot.show is being talked about in the context of it being a function.

Copy link
Contributor

Choose a reason for hiding this comment

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

"exits" is definitely incorrect for a function. Perhapspyplot.show() (with parentheses) would make things clearer?

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)``,
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
Thefigures will also be "live" if you use ``pyplot.show(block=True)``,
It any case thefigures will be "live" if you use ``pyplot.show(block=True)``,

Copy link
Member

Choose a reason for hiding this comment

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

In any case,

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

in any case is an ambigious reference 'cause it's not clear what the cases are ...


`.pyplot.figure`
*`.pyplot.figure`
Copy link
Member

Choose a reason for hiding this comment

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

I would prefer to leave these as definition lists rather than bullet points.

<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,
Copy link
Member

Choose a reason for hiding this comment

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

I use "live" here to try and disambiguate it from the several other meanings of the word "interactive".

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

"live" needs to be defined on first usage - I try to do it a little later but I can pull it up here.

@@ -67,54 +68,46 @@ loop is properly integrated with the command line (see
.. highlight:: ipython

::

user@machine:~ $ ipython
Copy link
Member

Choose a reason for hiding this comment

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

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.

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

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


.. sourcecode:: ipython

%matplotlib notebook

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;
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
which uses the `.backend_nbagg` backend whichis installed by Matplotlib;
which uses the `.backend_nbagg` backend whichpart of Matplotlib;

"is installed by" implies it is an external package that we depend on which it is a first-party backend.

Copy link
Member

Choose a reason for hiding this comment

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

which part of -> from

@tacaswelltacaswell added this to thev3.3.0 milestoneMay 21, 2020
appropriate. Matplotlib keeps a reference to all of the open figures
appropriate.

Matplotlib keeps a reference to all of the open figures
created this way so they will not be garbage collected. You can close
Copy link
Member

Choose a reason for hiding this comment

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

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.

- pyplot.show will returnimmediatelyby default
- newly created figures will bedisplayed immediately
- figures will automatically redrawwhen elements are changed
-`pyplot.show` displays the figures andimmediatelyreturns to the prompt
Copy link
Member

Choose a reason for hiding this comment

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

That assumes you're in a prompt...

Though in a script, ifplt.ion() is called, thenplt.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).

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

Yeah, this is my frustration w/ the plt.show() docs - they kind of assume a prompt too and it's really unclear.

Copy link
Member

Choose a reason for hiding this comment

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

Not really? It just saysshow won't return, and nothing about prompts.

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

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.

Copy link
Member

Choose a reason for hiding this comment

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

That is no longer the first line ofshow() docs.

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

🤦

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)``,
Copy link
Member

Choose a reason for hiding this comment

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

In any case,


.. sourcecode:: ipython

%matplotlib notebook

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;
Copy link
Member

Choose a reason for hiding this comment

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

which part of -> from

@tacaswelltacaswell added the Release criticalFor bugs that make the library unusable (segfaults, incorrect plots, etc) and major regressions. labelMay 27, 2020
@QuLogicQuLogic requested a review fromtacaswellMay 30, 2020 08:17

::

In [5]: ln.set_color('orange')

it will be reflected immediately. If you wish to disable this behavior
use
If you wish to disable interactive modification of the plot:
Copy link
Member

Choose a reason for hiding this comment

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

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.

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

I'm using interactive modification == automatic redraw, but will clarify that

@tacaswell
Copy link
Member

Getting this sorted should not block tagging the RC.

@story645
Copy link
MemberAuthor

folks are welcome to squash merge this

Copy link
Member

@tacaswelltacaswell left a comment

Choose a reason for hiding this comment

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

Anyone can merge on green.

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>
@QuLogicQuLogic merged commitf8e4012 intomatplotlib:masterJun 16, 2020
@story645story645 deleted the interactivity branchJune 16, 2020 17:41
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@tacaswelltacaswelltacaswell approved these changes

@QuLogicQuLogicQuLogic approved these changes

@anntzeranntzeranntzer left review comments

@dstansbydstansbydstansby approved these changes

Assignees
No one assigned
Labels
DocumentationRelease criticalFor bugs that make the library unusable (segfaults, incorrect plots, etc) and major regressions.
Projects
None yet
Milestone
v3.3.0
Development

Successfully merging this pull request may close these issues.

5 participants
@story645@tacaswell@QuLogic@anntzer@dstansby

[8]ページ先頭

©2009-2025 Movatter.jp