-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Switching to inline backend closes GUI windows #15913
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
I don't really have a good feel for whether what you are asking for is possible or not, but have you tried the |
I guess I have a few issues with
|
Just a note that Fair enough about "pop-out" plots. Hopefully someone here can speak to how those work or if there is a workflow that can suit your needs. |
See also #14471. I think this should be doable (if the event loops are not compatible we error out anyways, but otherwise I don't see why we can't have e.g. qt5agg and qt5cairo windows coexisting)? Does simply removing the call to If that works there's a reasonable way forward with the behavior change (of ultimately not calling |
This issue has been marked "inactive" because it has been 365 days since the last comment. If this issue is still present in recent Matplotlib releases, or the feature request is still wanted, please leave a comment and this label will be removed. If there are no updates in another 30 days, this issue will be automatically closed, but you are free to re-open or create a new issue if needed. We value issue reports, and this procedure is meant to help us resurface and prioritize issues that have not been addressed yet, not make them disappear. Thanks for your help! |
Bug report
Bug summary
When a plot is made with the
qt5
backend on and then the backend is changed toinline
, the active plot window(s) are closed. This makes it very difficult to switch cleanly between backends within a notebook. The two mediocre workarounds I can see are:plt.show(block=True)
and switch back toinline
after the user is done with the GUI figure. This has the downside of locking the Notebook execution while the figure is live.Code for reproduction
The linked gist shows what I'd like to accomplish which is a context manager that enables matplotlib plotting in a GUI window from within a Notebook that is otherwise using the
inline
backend. Basically I want the notebook to use inline (for a variety of reasons), but I occasionally wish I could interact with the data in a separate figure.https://gist.github.com/flutefreak7/65d824358122360911e2d4c43085007a
As a side note, easy switching between
inline
andnotebook
/widget
backends would also scratch part of this itch, but the interactive notebook backends still don't enable full screen usage or easily throwing a plot on another monitor.ipyvolume
has full screen figured out, so that seems doable.Here's the context manager I wish worked:
Actual outcome
The outcome of the above code is that a plot window flashes into existence for a split second, then is closed when the
%matplotlib inline
call is processed.Expected outcome
It would be great if plots created with the qt5 backend could stay visible while other plots with the inline backend were also being created. If use
%gui qt
(to establish a reliable event loop) and create a bunch of Qt windows by other means, they live concurrently with the Notebook as long as the kernel is alive. I'd like matplotlib GUI figures to be able to live on regardless of the current backend.Matplotlib version
print(matplotlib.get_backend())
):inline
andqt5agg
The text was updated successfully, but these errors were encountered: