Skip to content

Doc event loop requirements for Figure.show#13590

Merged
dstansby merged 1 commit into
matplotlib:masterfrom
timhoffm:doc-figure-show
Mar 6, 2019
Merged

Doc event loop requirements for Figure.show#13590
dstansby merged 1 commit into
matplotlib:masterfrom
timhoffm:doc-figure-show

Conversation

@timhoffm

@timhoffm timhoffm commented Mar 5, 2019

Copy link
Copy Markdown
Member

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

timhoffm commented Mar 5, 2019

Copy link
Copy Markdown
Member Author

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

@anntzer

anntzer commented Mar 5, 2019

Copy link
Copy Markdown
Contributor

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

timhoffm commented Mar 5, 2019

Copy link
Copy Markdown
Member Author

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

anntzer commented Mar 5, 2019

Copy link
Copy Markdown
Contributor

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
Copy Markdown
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

anntzer commented Mar 5, 2019

Copy link
Copy Markdown
Contributor

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

@dstansby

dstansby commented Mar 6, 2019

Copy link
Copy Markdown
Member

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