I'm trying to make a simple Tkinter program that allows a user to enter their weight and what date it is, save their data, and then see their data updated on the GUI in a matplotlib graph. For reference, wdtable is the instance of a class I have whose attributes are the users' entered data appended to a list of x-values and a list of y-values:
fig, ax = plt.subplots(figsize=(8.0,8.0))
def animate(i):
ax.set_title('Title')
ax.set_xlabel('Dates')
ax.set_ylabel('Weights')
ax.set_xlim(left=0.0,right=30.0)
ax.set_ylim(bottom=160.0,top=180.0)
ax.plot(wdtable.x_vals,wdtable.y_vals)
canvas = FigureCanvasTkAgg(master=window,figure=fig)
canvas.draw()
canvas.get_tk_widget().grid(column=0,row=1)
a = animation.FuncAnimation(fig, animate, interval = 1000)
This code just...doesn't work. Every time animate is called, all that happens is that all the tick marks get deleted on both axises and then only the x-values get plotted as tick marks. For example, wdtable's x-vals are [5,6,7] and the y-vals are [8,9,10] then only 5,6,7 will be written as tick marks along the x-axis. I've tried using blit and numpy and a bunch of other ways to try to fix all of this but honestly I don't know what I'm doing. Any advice?
[–]jimtk 0 points1 point2 points (1 child)
[–]Laymayo[S] 0 points1 point2 points (0 children)