Open
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 numpy as np
import matplotlib.pyplot as plt
# Generate some data
t = np.arange(0, 10, 0.1)
x = np.cos(t)
fig, ax = plt.subplots(1,1)
# Put the figure in the top-left half of the screen
cur_win = fig.canvas.manager.window # Current window
screen_size = cur_win.wm_maxsize() # Get the screen size
# top-left half of the window:
(pos_x, pos_y, width, height) = (0, 0, screen_size[0]//2, screen_size[1]//2)
position = f'{width}x{height}+{pos_x}+{pos_y}' # Window geometry string
cur_win.geometry(position)
ax.plot(t, x)
plt.show()
Actual outcome
Expected outcome
When the size of the window is then MANUALLY changed, the figure immediately changes to the accurate scale:
Additional information
The bug appears from Matplotlib 3.5.1 onward
Operating system
Windows 11
Matplotlib Version
3.5.1
Matplotlib Backend
TkAgg
Python version
3.9.10
Jupyter version
No response
Installation
No response