-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
FigureCanvas.draw() with tight_layout () needs to be called twice with Matplotlib 2.1.0 #10361
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 have some guesses as to whats wrong, but a link to a self contained example (if its too long to post here) would help. Have you tried If you don't call |
Sorry for not providing a self-contained example, I haven't found the time yet to carve out a MWE from my code containing a matplotlib-widget and some dummy code. In the meantime - if you don't mind the trouble (don't hit me!) - pyfda can be installed/deinstalled easily via I've tried your suggestions:
The problem seems to be around for a while though: https://stackoverflow.com/questions/18678306/matplotlib-qt-tight-layout-doesnt-work-on-the-first-draw#18702991 The proposed measure didn't help in my case though. |
Dynamically updating the plots only when the tab has been made visible fixes this bug as well. |
I'm closing this, unless there is a MWE for us to see what the problem is. Thanks! |
Bug report
Bug summary
PyQt widgets with a Matplotlib (versions 2.1.0 and 2.1.2) canvas don't respect
tight_layout()
unless a redraw is triggered for the second time. The class shown below (excerpt) is instantiated in all plotting widgets in the app under https://github.com/chipmuenk/pyfda .The full code can be found under
https://github.com/chipmuenk/pyFDA/blob/develop/pyfda/plot_widgets/mpl_widget.py
In the pyfda project, the bug is referenced as chipmuenk/pyfda#113 .
Code for reproduction
Actual outcome
The plot is surrounded by a lot of whitespace
Expected outcome
The plot should be formatted with a tight_layout() layout. This was the case with matplotlib 1.4.2, 1.5.2, 1.5.4 and 2.0
Matplotlib version
Installation via conda (default channel)
The text was updated successfully, but these errors were encountered: