How to integrate a matplotlib subplot inside a Tkinter frame, so that I can update it on each iteration? Currently, I have defined four quadrants as four frames inside a Tkinter master, and there is a button which will call a function, which will perform some calculation and plot the result in the subplot (to be integrated into one of the frames). I am having issues in plotting new data on the same plot. A new plot is always getting created on each call. (see ss, yellow region is a different frame)
Here is my code snippet(written inside the function being called through button widget):
'''figure = plt.Figure(figsize=(3.5,3.5), dpi=100)
ax = figure.add_subplot(111)
ax.plot(t,Ps)
chart_type = FigureCanvasTkAgg(figure, master=f2)
chart_type.draw()
chart_type.get_tk_widget().grid()'''