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 commented on 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 commented on Jan 6, 2020
Is this a regression, or did it always do this?
lukelbd commented on 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 commented on 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 commented on 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 commented on Jan 6, 2020
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:
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 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
matplotlib/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 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.
dopplershift commented on 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 commented on May 5, 2020
Thanks for the PR/fix @dopplershift !