I want to make a pie chart animation in python where it will be changing continuously according to the data (which is being changed continuously through loop). The problem is that it is printing every pie chart one by one and I end up having many pie charts. I want one pie chart to change in place so that it seems like an animation. Any idea how to do this?
I am using the following the code
colors = ['gold', 'yellowgreen', 'lightcoral', 'lightskyblue', 'black', 'red', 'navy', 'blue', 'magenta', 'crimson']
explode = (0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, .01)
labels = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9']
nums = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
for num in range(1000):
str_num = str(num)
for x in range(10):
nums[x] += str_num.count(str(x))
plt.pie(nums, explode=explode, labels=labels, colors=colors, autopct='%1.1f%%', shadow=True, startangle=140)
plt.axis('equal')
plt.show()
