Plotting in Viewer window from a job

Hi,

I have a question about the interaction of jobs with RStudio Viewer pane --- where you usually see plotly plots. I'm have a plotly object that I create in a job and keep updating it, and would like to be able to visualize the result while the job runs. I can save the object in an rds file and open it from the console, but I would really like it to be automatic and not require me to revisit the file every once in a while, e.g. whenever it is updated.
In short, I would like a job to present plotly objects on the Viewer.

Also, two related question:

  1. What can I use the Viewer pane for? can I view html files on? is there anything other than plotly that interacts with it?
  2. RStudio allows me to create as many display devices equivalent to the plot pane, by using dev.new(). It comes with two devices, the built in one and the external one in case that you "pop out" the plot pane, but I can create as many as I want. Can I do the same with the Viewer pane? I.e., can I create multiple devices of the same type as that of Viewer to present different plotly objects? that would be very useful.

Thanks!

Have you considered whether this might be a good usecase for developing a simple shiny app?. One that creates the plotly object and renders the result as it changes?

Update: found some good enough resources to be able to do what I want, so please ignore my request in last message; it was way easier than I thought.

Thanks so much for the suggestions, it is very helpful!

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

Hi, thanks much for the suggestion. I must admit that I never developed a shiny app; I have no doubt I can learn it but I do not know anything how difficult/long is the learning curve. (I've been working with ggplot2 since forever, and only became familiar with plotly via ggplotly a few months back; it has been a game changer, and my work right now really benefits from it.)

Since I'm clueless at the moment about Shiny apps --- are they going to create a separate window, even with an R script running from RStudio as a job --- and refresh as the object presented is modified? or at least allow me to call a refresh function from the script to do so?
Also, I know that there are plenty of resources to learn how to write Shiny apps, but if you have any suggestion for a good/favorite one I'll highly appreciate it.

Thanks much!