Last active
March 14, 2023 13:09
-
-
Save rlabbe/ea3444ef48641678d733 to your computer and use it in GitHub Desktop.
Plot with matplotlib with real time updates without plt.pause
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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() |
It makes sense because it works for me (and some others), and this is a convenient place to store such things. I don't need somebody else to do my thinking for me, thank you.
I have no idea what setups people have, what versions, what OS, what backend, etc. And I certainly can't help when the entire message is "it does not work". Lazy efforts get zero response.
But again, I don't really care, this is for me only.
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
Ok, but maybe you can fix it. It has no sence to post something that does not work. (Im not the only one who can't let it work)