Skip to content

plot disappears when moved to second monitor #8500

Closed

Description

@mmckerns

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.

Activity

  1. tacaswell commented on Apr 17, 2017

    @tacaswell
    Member

    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).

  2. added this to the milestone on Apr 17, 2017
  3. mmckerns commented on Apr 17, 2017

    @mmckerns
    Author

    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.

  4. tacaswell commented on Apr 17, 2017

    @tacaswell
    Member

    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.

  5. mmckerns commented on Apr 17, 2017

    @mmckerns
    Author

    @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.

  6. QuLogic commented on Apr 17, 2017

    @QuLogic
    Member

    Duplicate of #8387.

  7. tacaswell commented on Apr 18, 2017

    @tacaswell
    Member

    Oh good, I miss-read your first comment to be that simple resizing the window on a single monitor was enough to break ti!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions