Matplotlib处于非阻塞模式?

时间:2015-08-25 14:47:08

标签: python matplotlib ipython-notebook

我正在尝试根据用户输入显示不同的数据集。 我正在尝试下面的示例代码:

import matplotlib.pyplot as plt
import numpy as np

N = int(raw_input())

X = []
Y = []

for i in range(N):
    X.append(np.linspace(0,10,11))
    Y.append( np.random.randn(11) )




def plotData(x, y):
    fig = plt.figure()
    plt.plot(x, y)

    plt.show(block=False)

plotNumb = int(raw_input('Which plot should I display for you [integer from 0 to ' + str(N-1) + ']? '))

plotData(X[plotNumb],Y[plotNumb])

keepGoing = True
while keepGoing:
    plotNumb = int(raw_input('Can I show you another one IN ADDITION [integer from 0 to ' + str(N-1) + ']? '))
    plotData(X[plotNumb],Y[plotNumb])

    keepGoing = raw_input("Do you want to keep going?")
    if keepGoing == "Yes":
        keepGoing = True
    else:
        keepGoing = False

问题是,数据没有显示,如图所示:

enter image description here

有没有办法让这个东西在两个输入后都不调用show()而工作?我也不想跟踪用户已关闭的窗口。

有没有人有任何好的建议?

编辑:据我所知,如果没有解决方法,手册中无法做到这一点。但是,也许有人知道一种解决方法。

0 个答案:

没有答案
相关问题