Skip to content

Instantly share code, notes, and snippets.

@rlabbe
Last active March 14, 2023 13:09
Show Gist options
  • Save rlabbe/ea3444ef48641678d733 to your computer and use it in GitHub Desktop.
Save rlabbe/ea3444ef48641678d733 to your computer and use it in GitHub Desktop.
Plot with matplotlib with real time updates without plt.pause
# draw the figure so the animations will work
import matplotlib.pyplot as plt
fig = plt.gcf()
fig.show()
fig.canvas.draw()
while True:
# compute something
plt.plot([1, 2, 3, 4, 5], [2, 1, 2, 1, 2]) # plot something
# update canvas immediately
plt.xlim([0, 10])
plt.ylim([0, 10])
plt.pause(0.01)
fig.canvas.draw()
@OrangoMango
Copy link

As you want, I wanted just to inform you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment