I have an animated line using the example given on the matplotlib site:
import matplotlib.pyplot as plt
import numpy as np
x = np.linspace(0, 2 * np.pi, 100)
fig, ax = plt.subplots()
(ln,) = ax.plot(x, np.sin(x), animated=True)
plt.show(block=False)
plt.pause(0.1)
bg = fig.canvas.copy_from_bbox(fig.bbox)
ax.draw_artist(ln)
fig.canvas.blit(fig.bbox)
for j in range(100):
fig.canvas.restore_region(bg)
ln.set_ydata(np.sin(x + (j / 100) * np.pi))
ax.draw_artist(ln)
fig.canvas.blit(fig.bbox)
fig.canvas.flush_events()
This yields the plot:
When I resize the window of the figure, it no longer works as intended:
What is the problem here?

