0

I didn't read a Python programming assignment clearly enough apparently and I'm required to have dynamically updating plot. That lab is already late and I'm not really fishing for a complete answer just a nudge in the right direction how I should implement this because thus far Ive only implemented static regular plots in matplotlib.

I'm doing this in jupyter notebook thusfar.

I already have pre-computed x (which is just indeces from 0 until the last one) and pre-computed y (for each indeces from 0 until last one). There isn't going to be new data.

the key is to have the plot start such that the first 7 x's are visible, and then for those x's, you would have the y's visible.

then the plot should update such that the 0eth x disappears, and 8th x appears and is plotted. So the it keeps rolling like a 7-sized window rightwards across those values.

Late347
  • 35
  • 1
  • 7
  • Do you want an animated plot or an interactive plot, where the user has control over the displayed content? Also, what have you tried so far? – James Mar 18 '19 at 01:09
  • 1
    The "nudge in the right direction" would be: Search for `FuncAnimation` and check the [animation examples](https://matplotlib.org/gallery/index.html#animation). – ImportanceOfBeingErnest Mar 18 '19 at 01:18
  • the plot doesnt need to be user interactive, only plot the pre-computed data values in a rolling way. I suppose it could have a blocking input in the beginning to start the whole animation when you run the notebook so it blocks until you press a key, and then it starts the plotting at the end – Late347 Mar 18 '19 at 01:24
  • "the problem" with some solution like this one https://stackoverflow.com/questions/17895698/updating-the-x-axis-values-using-matplotlib-animation seems to be that I'm not sure yet how I will have my data set up to be. Currently I prepared my data strictly in the fashion of tabular format in dataframe, so for each x point, I will have corresponding y point ready, so I would rather not change everyting back into some kind of weird matrices unless there is good reason to... – Late347 Mar 18 '19 at 01:28

0 Answers0