Skip to content

Doc event loop requirements for Figure.show #13590

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 1 commit into from
Mar 6, 2019

Conversation

timhoffm
Copy link
Member

@timhoffm timhoffm commented Mar 5, 2019

PR Summary

Trying to better document Figure.show() and how it's different from plt.show().

Hopefully this is reasonably correct and understandable so that #13586 or #13101 do not happen anymore. Improvements welcome as this is hard to describe (see discussion in #13101).

@timhoffm timhoffm added this to the v3.1.0 milestone Mar 5, 2019
@timhoffm
Copy link
Member Author

timhoffm commented Mar 5, 2019

Milestoning 3.1 because it would be nice if this would make it into the docs soon. But feel free to re-milestone.

@anntzer
Copy link
Contributor

anntzer commented Mar 5, 2019

I actually think we should just deprecate Figure.show() in favor of e.g. plt.show(figures=[fig1, fig2]) (if you really want to raise just a subset of figures).

Figure.show only works for pyplot-managed figures, so it makes sense to have that functionality in pyplot, plus having it it plt.show() will properly spin up the event loop if needed.

If you are managing your own GUI then hopefully you are not using pyplot (...), in which case fig.show() is not useful.

@timhoffm
Copy link
Member Author

timhoffm commented Mar 5, 2019

Given #13101 (comment), can we really deprecate Figure.show()?

Not an expert on this, but there seem to be two differences betweeen the two show() functions:

  1. Rasing all vs. only one figure
  2. Managing an event loop.

plt.show(figures=[fig1, fig2]) only addresses 1.

@anntzer
Copy link
Contributor

anntzer commented Mar 5, 2019

But plt.show(figures=[fig1, fig2]) would also reuse the code that already exists in plt.show() to manage the event loop.

@tacaswell
Copy link
Member

I think the improvements to plt.show can be done separately.

Currently plt.show calls show from the backend bases template which calls manager.canvas.figure.show() which then calls manager.show() so there is clearly some room for simplifying that call chain.... We will never be able to deprecated manager.show() as that is typically inherited from the underlying GUI widget.

@anntzer
Copy link
Contributor

anntzer commented Mar 5, 2019

I'm not talking about deprecating manager.show() (which is indeed needed as a backend customization point), just figure.show().

@dstansby
Copy link
Member

dstansby commented Mar 6, 2019

Thanks, I think this will be helpful 👍

@dstansby dstansby merged commit da701ae into matplotlib:master Mar 6, 2019
meeseeksmachine pushed a commit to meeseeksmachine/matplotlib that referenced this pull request Mar 6, 2019
dstansby added a commit that referenced this pull request Mar 6, 2019
…590-on-v3.1.x

Backport PR #13590 on branch v3.1.x (Doc event loop requirements for Figure.show)
@timhoffm timhoffm deleted the doc-figure-show branch March 6, 2019 14:56
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