简体   繁体   中英

Is there an easy way to scrub back and forth through a series of plots with matplotlib?

I have a Pandas DataFrame from which I can create a plot for every row. I'd like to be able to render the plot, and then ideally use some kind of slider to roll forward and backward through the rows of the DataFrame so I can visualize how the data change across rows.

One way I could do this is to render all the images and create a video, but then I don't know of a video player where I can scrub frame by frame. If there is such a thing, that would likely solve my problem.

What you are asking for an interactive plot. There are several libraries out there which can do this. I have used Bokeh for this kind of task before and it will be pretty easy for you to do that using their online documentation. You can use a slider or a text field for the row number and render the plot in real time.

https://docs.bokeh.org/en/latest/docs/gallery.html

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM