As per the title, consider the following snippet:
import time
import ipympl
import matplotlib.pyplot as plt
fig, ax = plt.subplots(1, 1, figsize=(5, 5))
data = []
plt.show()
for idx in range(4):
data.append(idx ** 2)
ax.clear()
ax.plot(data)
fig.canvas.draw()
time.sleep(0.2)
and this is what I get running it:

I used plt.show() at the beginning of the loop because nothing gets drawn otherwise.
Is there a way to avoid this?