Python 在使用Matplotlib的每个循环期间,我是否可以显示不同的图像?图像多恩';跑步时不出现
我想在迭代期间显示图像 我在运行过程中遇到了空的初始图形 但是,如果我停止运行,将显示图像 问题是什么?我正在使用python 3.6Python 在使用Matplotlib的每个循环期间,我是否可以显示不同的图像?图像多恩';跑步时不出现,python,Python,我想在迭代期间显示图像 我在运行过程中遇到了空的初始图形 但是,如果我停止运行,将显示图像 问题是什么?我正在使用python 3.6 plt.ion() # turn on interactive mode, non-blocking `show` for loop in range(0, 3): y = np.dot(x, loop) plt.figure() # create a new figure plt.plot(x
plt.ion() # turn on interactive mode, non-blocking `show`
for loop in range(0, 3):
y = np.dot(x, loop)
plt.figure() # create a new figure
plt.plot(x, y) # plot the figure
plt.show() # show the figure, non-blocking
_ = input("Press [enter] to continue.") # wait for input from the user
plt.close()
只需在plt.show()之后添加一点暂停
plt.show()
plt.pause(0.001)