You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
set_size_inches doesn't resize window on macosx backend #15131
Hopefully this can be fixed soon. This issue prevents me from performing automatic figure resizing in proplot when the MacOSX backend is enabled (on macOS Catalina).
Not sure. Looks like the MacOSX backend dates back very far but I couldn't find any other issues. I wouldn't be surprised if this is restricted to the latest macOS versions (Catalina, and IIRC this was also an issue for me on Mojave). Or perhaps very few people resize their figures in-place :)
.. I have it behaving this way back to at least 2.1.0 on Catalina. Someone who needs this to work will need to dig into it to see what the problem is. Given that most of the devs use Qt5 or webAgg, and this has been around for a few years, I wouldn't count on this to be fixed "soon".
Sorry if that came off wrong, just wanted to generate some discussion / hopefully get the attention of someone more experienced than me. I'll definitely dig around if I get the chance (I also use Qt5 but have been trying to make my auto-figure resizing algorithm more robust).
The likely culprit is that Figure.set_size_inches calls the figure manager resize method to "push" the resize to the backend, but FigureManagerMac does not implement a resize method:
So just the empty base method gets called. It also seems that _macosx.FigureManager (inherited by FigureManagerMac) does not have a resize method (see _macosx.m). I tried to implement my own resize method by accessing the "window" like in backend_qt5.py
but there does not seem to be any sort of "window" object on FigureManagerMac. I also tried simply calling FigureCanvasMac.resize from FigureManagerMac.resize but seems to really mess up the figure display.
Not sure where to go from here; hopefully this helps someone else.
I'm making some headway on this, along with a variety of other clean-ups for the macosx backend. It's complicated by the fact that the Figure windows on the Mac backend aren't using any kind of layout--it's hand-coded widget placement.
Activity
lukelbd commentedon Jan 6, 2020
Hopefully this can be fixed soon. This issue prevents me from performing automatic figure resizing in proplot when the MacOSX backend is enabled (on macOS Catalina).
jklymak commentedon Jan 6, 2020
Is this a regression, or did it always do this?
lukelbd commentedon Jan 6, 2020
Not sure. Looks like the MacOSX backend dates back very far but I couldn't find any other issues. I wouldn't be surprised if this is restricted to the latest macOS versions (Catalina, and IIRC this was also an issue for me on Mojave). Or perhaps very few people resize their figures in-place :)
jklymak commentedon Jan 6, 2020
.. I have it behaving this way back to at least 2.1.0 on Catalina. Someone who needs this to work will need to dig into it to see what the problem is. Given that most of the devs use Qt5 or webAgg, and this has been around for a few years, I wouldn't count on this to be fixed "soon".
lukelbd commentedon Jan 6, 2020
Sorry if that came off wrong, just wanted to generate some discussion / hopefully get the attention of someone more experienced than me. I'll definitely dig around if I get the chance (I also use Qt5 but have been trying to make my auto-figure resizing algorithm more robust).
lukelbd commentedon Jan 6, 2020
The likely culprit is that
Figure.set_size_inchescalls the figure managerresizemethod to "push" the resize to the backend, butFigureManagerMacdoes not implement aresizemethod:matplotlib/lib/matplotlib/backends/backend_macosx.py
Lines 107 to 129 in c185494
So just the empty base method gets called. It also seems that
_macosx.FigureManager(inherited byFigureManagerMac) does not have a resize method (see _macosx.m). I tried to implement my own resize method by accessing the "window" like inbackend_qt5.pymatplotlib/lib/matplotlib/backends/backend_qt5.py
Lines 629 to 635 in c185494
but there does not seem to be any sort of "window" object on
FigureManagerMac. I also tried simply callingFigureCanvasMac.resizefromFigureManagerMac.resizebut seems to really mess up the figure display.Not sure where to go from here; hopefully this helps someone else.
dopplershift commentedon Mar 31, 2020
I'm making some headway on this, along with a variety of other clean-ups for the macosx backend. It's complicated by the fact that the Figure windows on the Mac backend aren't using any kind of layout--it's hand-coded widget placement.
dstansby commentedon May 5, 2020
Thanks for the PR/fix @dopplershift !