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
plot disappears when moved to second monitor #8500
This is a weird bug that I have not been able to test, due to the unusual circumstances it appears. I also haven't been able to find mention of it elsewhere, so I'm stuck reporting it.
I was teaching a class where the projector screen was being used as a second monitor, and not duplicating the laptop screen. When I plot anything with matplotlib, it works just fine when it appears on the laptop screen. When I move the plot to the projector screen, the plot disappears... at about 75% on the projector screen, you can see the plot... but any more than that, the plot disappears. What's left is a blank window (i.e. what it looks like when you clear a plot). It has happened on every plot I've tried the past two weeks, at two different institutions.
To reproduce this bug, you'll need a second monitor. I've had overhead projectors only, but will try a second monitor shortly. I have seen the bug using matplotlib 2.0.0, python 2.7.13, and macOS Sierra 10.12.3. Any plot works, so plot(x) should do it, when you drag the plot onto the second monitor. Displaying a plot worked as expected previously, however, this is my first attempt displaying a plot using a second monitor with sierra. I installed matplotlib with macports, if that matters, and I'm using the MacOSX backend.
If I see the same effect on a second monitor (an actual monitor, not a projector), then I can test some variants. I have the opportunity today to try some other combinations of python and backend, and will update this issue accordingly.
This is almost certainly due to issues with the dpi scaling. My guess is your laptop screen is retnia? Does re-sizing the window once it is on the projector help?
Using tkagg should 'fix' the problem by side stepping it (as Tk is not high-dpi aware and OSX will just scale it).
I just tried it with a second monitor (non-projector), and it does the same thing. This issue is also reproduced in python 3.x, and with any display setting for the second and first monitor. @tacaswell, yep, it seems that it's a scaling issue with the MacOSX backend, as it doesn't happen with TkAgg and as you suggested when you resize the window the graph reappears.
wait, just resizing the window is enough to break it?
We need to be catching the resize / dpi change events that (I hope) the GUI is giving us and update our internal state. I suspect there is a buffer size miss-match going on.
@tacaswell: Yes, if the window is just dragged over to the second monitor, the displayed plot appears as if it were cleared. However, when the plot is resized, by dragging the corner of the GUI, the plot reappears. So, the workaround is easy, just resize the plot slightly after dragging it onto the second monitor, and the lines and axes reappear. However, if you don't know to resize the plot... you are left with a blank GUI window.
Activity
tacaswell commentedon Apr 17, 2017
This is almost certainly due to issues with the dpi scaling. My guess is your laptop screen is retnia? Does re-sizing the window once it is on the projector help?
Using tkagg should 'fix' the problem by side stepping it (as Tk is not high-dpi aware and OSX will just scale it).
mmckerns commentedon Apr 17, 2017
I just tried it with a second monitor (non-projector), and it does the same thing. This issue is also reproduced in python 3.x, and with any display setting for the second and first monitor. @tacaswell, yep, it seems that it's a scaling issue with the
MacOSXbackend, as it doesn't happen withTkAggand as you suggested when you resize the window the graph reappears.tacaswell commentedon Apr 17, 2017
wait, just resizing the window is enough to break it?
We need to be catching the resize / dpi change events that (I hope) the GUI is giving us and update our internal state. I suspect there is a buffer size miss-match going on.
mmckerns commentedon Apr 17, 2017
@tacaswell: Yes, if the window is just dragged over to the second monitor, the displayed plot appears as if it were cleared. However, when the plot is resized, by dragging the corner of the GUI, the plot reappears. So, the workaround is easy, just resize the plot slightly after dragging it onto the second monitor, and the lines and axes reappear. However, if you don't know to resize the plot... you are left with a blank GUI window.
QuLogic commentedon Apr 17, 2017
Duplicate of #8387.
tacaswell commentedon Apr 18, 2017
Oh good, I miss-read your first comment to be that simple resizing the window on a single monitor was enough to break ti!