-
-
Notifications
You must be signed in to change notification settings - Fork 8k
Doc changes to plt.show #11720
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
Doc changes to plt.show #11720
Conversation
There was already an attempt of making the block argument explicit in #11170 It didn't work out for some reason. Maybe it'll help to get it straight here though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why would it not do anything in interactive mode? I think it also shows the figure there.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure. It was written in the old docstring that it does nothing.
When I test it in spyder, the only difference is that the "thumbnail" in the toolbar start to blink if plt.show() is used. The figure window don't pop up to the front or something like that.
I didn't know about #11170. It doesn't seems clear what happens when reading that though. So the problem might be in one or several backends?
It looks like the exact same issue in the failing tests, if I recall that correctly, which is about the WebAgg backend. See https://github.com/matplotlib/matplotlib/pull/11170/files#r186467036.
ecbe866
to
d8efe5a
Compare
Yes, the WebAgg doesn't seem to work but isn't it solved by the the line that tacaswell comment? I try that now.
I don't know much about the different backends and how the backend class hierarchy works but to me it seems that the problem is that the show
in backend bases take a keyword block
but that this function is overridden in the WebAgg class with a show
that takes no arguments.
WebAgg is taken care of in the backend_bases show
.
d8efe5a
to
775c063
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can be shortend: "Whether the execution is blocked until the figures are closed."
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alternative suggestion:
If True, the execution is blocked until all displayed figures are closed. If False, the python execution continues after the figures are displayed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shorter:
The default is True unless interactive mode is enabled or %matplotlib
_ is used in IPython.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wouldn't want to go for the long version here. It's just redundant and doesn't add to the clarity.
775c063
to
add4327
Compare
I added a simple test of the input but I am not sure about the docstrings suggestions (or my own versions for that matter). I think that the explaination in the docstring that was suggested where to short.
I think that my docstring proposals contain the same amount of information, they are just less verbose. But a third opinion would be good.
A third opinion was being asked for: I can confirm that the two proposed changes by @timhoffm do indeed contain the same information.
But I can see how the initial proposals are easier to understand by inexperienced users. (On the other hand, more experienced users may be irritated by the verbosity compared to the ususal doc style.) In the end it may be a matter of taste and consistency.
This has been superseeded by
- Warn when trying to start a GUI event loop out of the main thread. #15504 addresses the signature of show by dynamic rewriting.
- DOC: Start to document interactive figures #4779 and Update plt.show() doc #14224 update the docstring.
@fredrik-1 sorry this stalled. Anyway, thanks for the contribution.
Rewrote the
pyplot.show
docstring and made the single kwargblock
explicit.Are the
block
keyword still experimental?