Hi I have this function that plot ten points in a graph and it is called every 30000 seconds. But I'm getting an error after a while it says Out of memory and the program close. Can anybody help me?
def plot(self):
if self.plot_frame is not None:
self.plot_frame.destroy()
self.plot_frame = tk.Frame(self, bg=self.bg)
self.plot_frame.pack(fill="both", expand=True)
simulation = Simulation
self.fig = plt.Figure()
simulation.ax = self.fig.add_subplot(111)
simulation.ax.set_title("Damage Accumulation Curve")
simulation.ax.set_xlabel("Load Case")
simulation.ax.set_ylabel("Accumulative Fatigue Damage")
x_axis = np.arange(0, len(Simulation.accumulated) )
x = np.array(x_axis[-10:])
y = np.array(Simulation.accumulated[-10:])
x = x[-10:]
y = y[-10:]
plt.clf()
simulation.ax.plot(x, y)
self.canvas = FigureCanvasTkAgg(self.fig, master=self.plot_frame)
self.canvas.get_tk_widget().pack(fill="both", expand=True)
self.canvas.draw()
self.graph_theta.set(Simulation.theta)
self.graph_arcl.set(Simulation.arcl)
self.after(30000, self.plot)