Skip to content

Use explicit kwarg for plt.show() #11170

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

Closed
wants to merge 3 commits into from

Conversation

dstansby
Copy link
Member

@dstansby dstansby commented May 4, 2018

I feel like this might be a Bad Idea, but can't work out why - maybe others will be able to tell me if it is or not! Either way, the doc change is probably welcome.

Will add API notes if/when someone reviews.

@dstansby dstansby added this to the v3.0 milestone May 4, 2018
"""
global _show
return _show(*args, **kw)
return _show(block=True)

Choose a reason for hiding this comment

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

I guess you mean return _show(block=block) here?

Copy link
Member Author

Choose a reason for hiding this comment

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

🤦‍♂️

@ImportanceOfBeingErnest
Copy link
Member

I do think it's a good idea. Maybe one could even check for block being a boolean. You won't believe how many people try to do things like plt.show(fig1), plt.show(ax) etc. Showing a useful error in such cases may be helpful for them.

@ImportanceOfBeingErnest
Copy link
Member

Apparently there is a problem with the web backend which doesn't take any arguments.

@dstansby dstansby force-pushed the show-kwarg branch 2 times, most recently from b8806d5 to d4d80e5 Compare May 5, 2018 09:40
@@ -319,7 +319,10 @@ def trigger_manager_draw(manager):
manager.canvas.draw_idle()

@staticmethod
def show():
def 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.

I thought we fixed this already....

@tacaswell
Copy link
Member

I am 👎 on changing the default value. If the user passed block=True we should block unconditionally on any other state.

I am very 👍 on @ImportanceOfBeingErnest 's suggestion of giving a good warning in the common incorrect use of passing figures or axes to plt.show (which does make sense in a guessing-the-API mode).

Copy link
Member

@tacaswell tacaswell left a comment

Choose a reason for hiding this comment

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

👎 on changing the default.

If the user passes block=True we need to block!

@dstansby
Copy link
Member Author

dstansby commented May 7, 2018

Is there currently a difference between block=None and block=True in terms of behaviour? I thought they were the same, but maybe not.

@ImportanceOfBeingErnest
Copy link
Member

Concerning block=True in the webbackend: #11201

@dstansby
Copy link
Member Author

Going to close this since I can't remember what's going on.

@dstansby dstansby closed this Jun 27, 2018
@tacaswell tacaswell removed this from the v3.0 milestone Jun 28, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants