我希望在数据即将出现时更新第1点,然后也更新第2点。在此之后,我可能想回去更新第1号地块。但是,我无法更新第1号地块。有什么帮助吗?
这是我的源代码:import matplotlib.pyplot as plt
import numpy as np
a = np.random.random(10)
b = np.random.random(10)
plt.subplot(311)
for i in range (10):
y = a[i]
x = b[i]
plt.scatter(x,y)
plt.pause(0.05)
plt.subplot(312)
for i in range (10):
x = a[i]
y = b[i]
plt.scatter(x,y)
plt.pause(0.05)
# update plot #1, but this doesn't work
aa = np.random.random(20)
bb = np.random.random(20)
plt.subplot(311)
for i in range (20):
y = aa[i]
x = bb[i]
plt.scatter(x,y)
plt.show()