I want to save my interactive graph as a png, i can do it through viewer and export it as png but i've thousands of them and must take them automatically.
There's a way which is using webshot
package, but i tried this approach and it takes alot of time, because i want to save them at the same time, for example : i've 4000 html graphs generated using R and must save them as image in time interval 1 min, when i use webshot
, it takes arround 43 mins because system2
takes alot of time .
so i want to export them using function which viewer pane use, here's an image explain what i want .
Here's code as an example for interactive graph, that doesn't mean my graphs r leaflet class, i provide it as an example.
library(leaflet)
m <- leaflet() %>%
addTiles() %>% # Add default OpenStreetMap map tiles
addMarkers(lng=174.768, lat=-36.852, popup="The birthplace of R")
and here's what i'm thinking of :
function(m,"SaveAs.png")
Please i need help, i searched a lot and spent a lot of time trying to find a solution.
according to this question How to save Leaflet in R map as png or jpg file?
It differs from my question , i need generic function for any interactive graphs , there's functions for plotly
but it's only for plotly graphs,Also the question usion webshot function which using PhantomJs and i mentioned above that PhantomJS is tooooo slow also Selenium also wkhtmltoimage, i tried lots of things.
Please notice that i need generic function or at least the function that viewer is using