I’m running into a problem with updating a plot that I’ve embedded into a Tk application. I’m attaching the code with this email (so hopefully that will show up at the end of the email). This is a very simple program, with one canvas embedded into a window, with one menu and one button Tk widgets that I’m using to select what plot type to display. The data are x, y, and t variables, with x and y given by cos(2pit) and sin(2pit) respectively. I’d like to be able to switch between a single scatter plot and two x(t) and y(t) plots. The program “works” in that when you resize the window, the plot updates, however, this really isn’t ideal. I’d like the plot to refresh when the button is clicked, and I can’t seem to get it to work, nor could I find support in previous email archives.
It seems like the trick used for animations, that is, only calling ‘plot’ once and simply changing the xdata and ydata values of the line would speed things up significantly, so I’ve implemented that in the code, but it doesn’t help.
Any help would be much appreciated! Thanks in advance.
embed_test.py (4.53 KB)