Saving Viewer plot as png

The code below creates a plot in the Viewer window, but it saves it as a blank png of size 318 bytes. I tried with 'browsable' instead of 'html_print' but got the same behavior. Also tried with saveWidget + webshot without success (as in [Save viewer object rendered in RStudio as image]).

Is there any way of saving the Viewer plot as a png automatically (without opening File Explorer or clicking on any action button)?

Thank you


      id = "myDiv",
      tags$head(HTML("<script src=''></script>")),
         var trace1 = { x: [1, 2, 3, 4], y: [10, 15, 13, 17], type: 'scatter' };
         var trace2 = { x: [1, 2, 3, 4], y: [16,  5, 11,  9], type: 'scatter' };
         var data   = [trace1, trace2];
         Plotly.newPlot('myDiv', data);"))

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

If you have a query related to it or one of the replies, start a new topic and refer back with a link.