在Python中使用Matplotlib进行交互式绘图

时间:2017-04-10 10:52:02

标签: python matplotlib

我在使用matplotlib库在python中绘图时遇到问题。在事件循环中工作时,数字没有响应,一旦代码结束,数字就会响应。没有使用pause命令就可以与数字交互?例如:

from matplotlib.pyplot import plot, draw, show

def make_plot():
    plot([1,2,3])
    draw()
    print ('continue computation')

print('Do something before plotting.')
# Now display plot in a window
make_plot()

answer = input('Back to main and window visible? ')
if answer == 'y':
    print('Excellent')
else:
    print('Nope')

show()

在上面的代码中,如果我要求用户输入,那么直到用户按下关键数字似乎没有响应,并且只要我们按下输入,即。代码完成图正在响应,但我们不再在代码中。请帮助我在事件循环中绘图

0 个答案:

没有答案
相关问题