MNT: Debug fig_size change after window close#29129
MNT: Debug fig_size change after window close#29129timhoffm wants to merge 1 commit intomatplotlib:mainfrom
Conversation
|
This is a result of #28838, which enabled the test everywhere, but at the time did not seem to be causing trouble. However, I am seeing the problem with wx and Qt when building 3.10.0rc1 for Fedora. I though it was because I was running Xvfb at 680x480 and the figure didn't fit, but even at 800x600 it failed. |
|
I've tried to move the Anyway, the proper fix is to understand why I've also tried to produce a minimal example: But (in the same environment as for the tests) this does not change figsize, so the effect seems somehow related to the addmittedly complex test setup. |
Works around the failure matplotlib#29129. A proper analysis and resolution is still needed.
|
TODO: Note to self: Check whether the obscure figsize change is corrected by #29855. |
This is a minimal reproducer for a failure in the pipeline #29125 (comment).
The
test_interactive_backend[toolmanager-MPLBACKEND=wxagg-BACKEND_DEPS=wx]fails in the pipeline at the subsequentassert result.getvalue() == result_after.getvalue()because the PNG data inresultandresult_afterhave different sizes (640x480) vs. (640x478); i.e.result_afteris two pixels smaller. This stems from a changed fig size, as made explicit by the assert statement added here (precisely,fig.get_size_inches()changes fromnp.array([6.4, 4.8])tonp.array([6.4, 4.78])).I have not yet a clue why closing the figure window could change the figure size.Actually, showing the window changes the size, see below.Note: reading the exception is a bit complicated because it happens in a called subprocess, but you'll find this somewhere in the middle of the traceback:
Update: This is the call stack that leads to the changed figure size:
Apparently
show()creates awx.EVT_SIZE, which is bound to_FigureCanvasWxBase._on_size(), and in therematplotlib/lib/matplotlib/backends/backend_wx.py
Line 659 in 1c4a554
returns the reduced height of 478.