How to update the contents of a FigureCanvasTkAgg

前端 未结 1 1220
自闭症患者
自闭症患者 2020-12-30 05:58

I\'m plotting some data in a Tkinter FigureCanvasTkagg using matplotlib. I need to clear the figure where I plot data and draw new data when a button is presse

相关标签:
1条回答
  • 2020-12-30 06:39
    #call the clear method on your axes
    self.ax.clear()
    
    #plot the new data
    self.ax.set_ylim(min(newy), max(newy))
    self.ax.semilogx(newx, newy, 'o-')
    
    #call the draw method on your canvas
    self.canvas.draw()
    

    hope this helps

    0 讨论(0)
提交回复
热议问题