-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
fig.show() doesn't block #13101
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
Comments
fig.show() can't block because if it did, then when it comes time to show
multiple figures, then the first figure would block the others.
…On Fri, Jan 4, 2019 at 1:01 PM David Stansby ***@***.***> wrote:
Bug report
Calling fig.show() on a figure doesn't block. Commenting out the input()
line below does block, and the figure shows fine. Also using plt.show()
instead works fine.
*Code for reproduction*
import matplotlib
matplotlib.use('qt5agg')from matplotlib import pyplot as plt
fig, ax = plt.subplots()
fig.show()# input()
*Matplotlib version*
- Operating system: MacOS
- Matplotlib version: 3.0.2
- Matplotlib backend (print(matplotlib.get_backend())): qt5agg
- Python version: 3.7.1
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#13101>, or mute the
thread
<https://github.com/notifications/unsubscribe-auth/AARy-PUO8if_Xvnw4qgLy7Sfl0WLjdKyks5u_5cMgaJpZM4ZqhxN>
.
|
Doh, that makes sense - is there not a way to do some stuff, open a figure that stays open, then do some other stuff and open another figure whilst keeping the first one open? |
You mean interactively in ipython?
|
No, just in a shell |
|
I'm clearly just very confused, |
To follow up a bit, there is an unfortunate name collision here, but
In general you don't have to actually use |
This should probably be mentioned in the documentation. Not sure I understand all this correctly. Is there any use-case for and end-user to call |
Yes, but they involve actively managing running the event loop. |
Is that the use case of embedding matplotlib in your own GUI application? Users from the command line/ipython/jupyter notebooks do not have to bother with |
It seems,
Here in cell 4, the window would open up and show a responsive(!) figure. Without closing the window I could continue to plot stuff and call Nowadays (py36, matplotlib 3), the second
In any case that is still more useful than getting unresponsive windows with |
I get a responsive window with
Figure window is immediately displayed and the command line is not blocked (no
which immediately updates the plot. |
Yes, your code works for me too. The problem is when you close the GUI window, and then want to get it back. |
...? But |
Surprisinigly perhaps, yes. In the case you closed it you'd also need to draw it though ( |
The visibility / non-visibility of the window is decoupled from it's existence in most GUI frameworks. This is really helpful for things like showing / hiding complex panes etc. In our case the continued existence also depends on a hard-ref to the underlying python object (but for pyplot, we register a callback on 'close' to remove it from pyplot's cache, which is why re-showing with |
Hm, quite elaborate. I have no idea how to describe the effect and intended way of usage in a concise way in the docstring. |
#4779 <- that is my attempt to be both concise and complete, it has gone badly :/ |
I just stumbled upon a situation where fig, ax = plt.subplots()
manager = plt.get_current_fig_manager()
manager.window.showMaximized() # For Qt5 backend.
fig.show()
... # Plotting objects in data coordinates: works fine.
#%%
... # Plotting objects in figure coordinates: fails because the objects fall in the pre-fullscreen positions. The current work-around is to add a code section with Another option is to add |
fig.show() does not block the window for showing plot multiple times. so, Quick fixes using self.fig.waitforbuttonpress() it waits user to press the button for next plot visualisation.
|
Bug report
Calling
fig.show()
on a figure doesn't block. Commenting out theinput()
line below does block, and the figure shows fine. Also usingplt.show()
instead works fine.Code for reproduction
Matplotlib version
print(matplotlib.get_backend())
): qt5aggThe text was updated successfully, but these errors were encountered: