Update time-series plot

I want to display a dashboard that updates plots in real time. For example, consider a data rate of 30 Hz, every 1/30th of a second a data point is inserted into a table. At this time I want the plot to update by removing 1 data point and adding the new one in.

So the solution I found is:

    output$rawData <- renderPlot({ 

The problem is that this is really choppy, I'm using ggplot for the plots in the update function. I realize that 30 times per second is perhaps to fast for my server PC but I have tried as few as 1 second updates and still cant seem to get it smooth. Has anyone had any experience with this kind of method? I am new to shiny so maybe I am approaching this wrong. Any tips?


This is one of the problems of using static graphics for something this highly dynamic (you'd need an extremely fast network connection to send images from server to client at 30x per second).

It's possible to get a better experience by using a web-based library and doing the minimal amount of work to update the chart (i.e. partially modify it). One such library would be plotly, and you can learn about partially modifying them in shiny here.

Also, here's an example of streaming data into a plotly chart in shiny -- https://plotly-r.com/linking-views-with-shiny.html#fig:shiny-stream

Also this example

Thanks for the tips, I will try it out and hopefully post my findings : )

This topic was automatically closed 54 days after the last reply. New replies are no longer allowed.