这可能是徒劳的,但是由于没有人有更好的解决方案,因此我去了线程模块,它起作用了。如果有人有更简单的方法来进行此操作,请告诉我。
import subprocessimport threadingfrom matplotlib import pyplot as mpl...class Graph(threading.Thread): def __init__(self,X,Y,min_tilt, min_energy): self.X = X self.Y = Y self.min_tilt = min_tilt self.min_energy = min_energy threading.Thread.__init__(self) def run(self): X = self.X Y = self.Y dx = (X.max()-X.min())/30.0 x = np.arange(X.min(),X.max()+dx,dx) y = quad(x,fit) fig = mpl.figure() ax = fig.add_subplot(1,1,1) ax.grid(True) ax.plot(x, y, 'g') ax.scatter(X, Y, c='b') ax.scatter(self.min_tilt, self.min_energy, c='r') mpl.show()thread = Graph(X,Y,min_tilt,min_energy)thread.start()



