为何我的三条绘图曲线中有一条出现压缩异常?
传感器Tkinter绘图偶发异常求助
我使用Python在Tkinter中绘制传感器数据,此前运行完全正常,但最近出现了一次十分怪异的情况,且仅发生过这一次,我无法解释原因,希望有人能提供思路。

绘图初始化代码
fig = plt.figure() #Init of fig and ax ax1 = plt.subplot(3, 1, 1) ax2 = plt.subplot(3, 1, 2, sharex = ax1) ax3 = plt.subplot(3, 1, 3, sharex = ax1)
Tkinter Canvas展示代码
self.canvas = FigureCanvasTkAgg(fig, self) self.canvas.get_tk_widget().pack(side=tk.TOP, fill=tk.BOTH, expand=True) toolbar = NavigationToolbar2Tk(self.canvas, self) toolbar.update() self.canvas._tkcanvas.pack(side=tk.TOP, fill=tk.BOTH, expand=True)
数据绘制函数
def plot_data(self): # plot data which got appended into lists ax1.clear() ax2.clear() ax3.clear() ax1.set_title("Acceleration data from " + self.timestr) #plt.ylabel("y", rotation = 0) ax1.set_ylabel("x-axis [g]") ax2.set_ylabel("y-axis [g]") ax3.set_ylabel("z-axis [g]") ax3.set_xlabel("ms") ax1.plot(self.x_graph, self.y1_graph, "k") ax2.plot(self.x_graph, self.y2_graph, "k") ax3.plot(self.x_graph, self.y3_graph, "k") self.canvas.draw_idle()
内容的提问来源于stack exchange,提问作者Xenoshell
相关产品推荐
相关产品推荐

