Title: [Bug]: Figure does not scale to window size · Issue #22822 · matplotlib/matplotlib · GitHub
Open Graph Title: [Bug]: Figure does not scale to window size · Issue #22822 · matplotlib/matplotlib
X Title: [Bug]: Figure does not scale to window size · Issue #22822 · matplotlib/matplotlib
Description: Bug summary When changing the window size of a figure, the figure does not scale immediately, so part of it is obscured. Only after a manual re-scaling (even if minute) the figure is displayed correctly. Code for reproduction import nump...
Open Graph Description: Bug summary When changing the window size of a figure, the figure does not scale immediately, so part of it is obscured. Only after a manual re-scaling (even if minute) the figure is displayed corr...
X Description: Bug summary When changing the window size of a figure, the figure does not scale immediately, so part of it is obscured. Only after a manual re-scaling (even if minute) the figure is displayed corr...
Opengraph URL: https://github.com/matplotlib/matplotlib/issues/22822
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"[Bug]: Figure does not scale to window size","articleBody":"### Bug summary\n\nWhen changing the window size of a figure, the figure does not scale immediately, so part of it is obscured. Only after a manual re-scaling (even if minute) the figure is displayed correctly.\n\n### Code for reproduction\n\n```python\nimport numpy as np\r\nimport matplotlib.pyplot as plt\r\n\r\n# Generate some data\r\nt = np.arange(0, 10, 0.1)\r\nx = np.cos(t)\r\n\r\nfig, ax = plt.subplots(1,1)\r\n\r\n# Put the figure in the top-left half of the screen\r\ncur_win = fig.canvas.manager.window # Current window\r\nscreen_size = cur_win.wm_maxsize() # Get the screen size\r\n# top-left half of the window:\r\n(pos_x, pos_y, width, height) = (0, 0, screen_size[0]//2, screen_size[1]//2)\r\nposition = f'{width}x{height}+{pos_x}+{pos_y}' # Window geometry string\r\ncur_win.geometry(position)\r\n\r\nax.plot(t, x)\r\nplt.show()\n```\n\n\n### Actual outcome\n\n\r\n\n\n### Expected outcome\n\nWhen the size of the window is then MANUALLY changed, the figure immediately changes to the accurate scale:\r\n\r\n\n\n### Additional information\n\nThe bug appears from Matplotlib 3.5.1 onward\n\n### Operating system\n\nWindows 11\n\n### Matplotlib Version\n\n3.5.1\n\n### Matplotlib Backend\n\nTkAgg\n\n### Python version\n\n3.9.10\n\n### Jupyter version\n\n_No response_\n\n### Installation\n\n_No response_","author":{"url":"https://github.com/thomas-haslwanter","@type":"Person","name":"thomas-haslwanter"},"datePublished":"2022-04-11T10:35:29.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":7},"url":"https://github.com/22822/matplotlib/issues/22822"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:4bd6c66f-0c4f-bf4e-ab8e-0a7b7efe9c29 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | EA24:B0958:106AB2C:1584EDB:6A51A354 |
| html-safe-nonce | 0feafd05b60ae9bdfe9f152630c82b5fe0cbd54fe1ee4e590255429ea9a0bef7 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFQTI0OkIwOTU4OjEwNkFCMkM6MTU4NEVEQjo2QTUxQTM1NCIsInZpc2l0b3JfaWQiOiI2NjUzODIyODkwNzYzNDYxNDYwIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | e42a9a2f7f9a59fbcd1a9dc5981600d5132424ce5abd73fe2aeb63da2eceeafb |
| hovercard-subject-tag | issue:1199762743 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/matplotlib/matplotlib/22822/issue_layout |
| twitter:image | https://opengraph.githubassets.com/33954a2bc809456121675a490033edd041ebb43462ca0c5875a8164b2c1cb3b1/matplotlib/matplotlib/issues/22822 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/33954a2bc809456121675a490033edd041ebb43462ca0c5875a8164b2c1cb3b1/matplotlib/matplotlib/issues/22822 |
| og:image:alt | Bug summary When changing the window size of a figure, the figure does not scale immediately, so part of it is obscured. Only after a manual re-scaling (even if minute) the figure is displayed corr... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | thomas-haslwanter |
| hostname | github.com |
| expected-hostname | github.com |
| None | b9a586c06a05a7a86fc7e3f4dbd03e42f6869085879aa184aa6369456dbd50fb |
| turbo-cache-control | no-preview |
| go-import | github.com/matplotlib/matplotlib git https://github.com/matplotlib/matplotlib.git |
| octolytics-dimension-user_id | 215947 |
| octolytics-dimension-user_login | matplotlib |
| octolytics-dimension-repository_id | 1385122 |
| octolytics-dimension-repository_nwo | matplotlib/matplotlib |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 1385122 |
| octolytics-dimension-repository_network_root_nwo | matplotlib/matplotlib |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 7aed05249554b889eb33d002851a973eebcc7e91 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width