FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Figure sticks out of window after setting window to full screen from code · Issue #26733 · matplotlib/matplotlib · GitHub

Repository navigation

Figure sticks out of window after setting window to full screen from code #26733

Description

Bug summary

When trying to display a a plot in full screen mode using pyplot, part of the figure is off the screen. The settings of the plot are definitely correct, since manually resizing the window fixes the issue.

Code for reproduction

import matplotlib.pyplot as plt

fig, ax = plt.subplots()
ax.plot([0],[0])

# plt.subplots_adjust(left=0.004, right=0.565, bottom=0.442, top=0.98) # <-- this line fixes it (on my screen)

# the culprit
plt.get_current_fig_manager().window.state('zoomed') # windowed full screen
# plt.get_current_fig_manager().full_screen_toggle() # non-windowed full screen | this also breaks, but this time there is no x to close the window

plt.show()

Actual outcome

Expected outcome

Additional information

The issue can be manually fixed by calling plt.subplots_adjust with some predetermined values, obtained by playing around with the GUI sliders. But this is clearly not the intended way.

If plt.get_current_fig_manager().window.state('zoomed') is used, manually resizing the window (snapping it out and back into full screen) fixes the issue.
If plt.get_current_fig_manager().full_screen_toggle() is used, the window can not be dragged (since its really in full screen mode), but it can not even be closed, because there is no x in the top right corner (I don't know if that is intentional or not).

Original SO post here.

EDIT: The error only occurs, when the Windows GUI scale (under Settings > System > Display > Scale and layout) is not set to 100%.

Operating system

Windows 10

Matplotlib Version

3.7.1

Matplotlib Backend

TkAgg

Python version

3.10.12

Jupyter version

NA

Installation

conda

Activity

  1. jklymak commented on Sep 11, 2023

    Member

    Both work fine on my Mac, after

    import matplotlib
    matplotlib.use('TkAgg')

    In the first case, it looks like you have a mismatch between cavas size and viewport size, where the viewport doesn't know about pixel doubling.

    In the second case, on my Mac, the window controls show up if I move the mouse to the upper left corner.

    I really don't think we control either of these functionalities - I think full_screen_toggle is what you want, but then you need to see how Windows will give you control of full screen app. Probably windows_key + shift + enter

  2. mategyerek commented on Sep 11, 2023

    Author

    I have investigated further and I realized that the bug only occurs, when the windows GUI scale (under Settings > System > Display > Scale and layout) is not set to 100%. Mine is at 175%, because I have a large resolution screen. Maybe there is something similar you can set on other OS-s to reproduce. That being said, the bug is probably unique to Windows.

  3. ksunden commented on Sep 11, 2023

    Member

    If I remember correctly, we do not have hidpi support for Tk, largely because I don't think TK natively has High-DPI support

    I remembered incorrectly: #19167

    See also: #21875

  4. kohinoorbasu commented on Mar 31, 2026

    I have investigated further and I realized that the bug only occurs, when the windows GUI scale (under Settings > System > Display > Scale and layout) is not set to 100%. Mine is at 175%, because I have a large resolution screen. Maybe there is something similar you can set on other OS-s to reproduce. That being said, the bug is probably unique to Windows.

    This fixed my issue. Thanks for the resolution.

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

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions


      Back | FazBrowse Home | New Git URL