Reputation: 10655
Code:
import matplotlib.pyplot as plt
from time import sleep
for i in range(100):
plt.pie([100-i,i])
sleep(1)
plt.show()
Problem with my code:
What I want to do:
thank you.
Upvotes: 3
Views: 1076
Reputation: 10655
Fixed it.
import matplotlib.pyplot as plt
from time import sleep
for i in range(100):
plt.pie([100-i, i])
plt.pause(.001)
plt.draw()
sleep(1)
plt.show()
is blocking function so instead used plt.draw()
along with plt.pause()
and now it's working as intended.
Upvotes: 0
Reputation: 979
add plt.close()
to your for-loop
import matplotlib.pyplot as plt
from time import sleep
for i in range(100):
plt.pie([100-i,i])
sleep(1)
plt.show()
plt.close()
Upvotes: 1