10.22 Exporting/Saving Graphs
- PNG: Easiest way is to use
and download the plot as a png.
- Printing in the browser is annoying
- Margin problem.. cut online (e.g. https://pdfresizer.com/crop)
- Now there is orca but it’s tedious to install…
p <- plot_ly(data = swiss, x = ~Catholic, y = ~Fertility, type = "scatter", mode = "markers")
getwd(...)
setwd(...)
export(p, file = "./generated-graphs/plotly.png") # PNG
htmlwidgets::saveWidget(p, "test.html") # HTML
# htmlwidget should be standalone
webshot::webshot("test.html", "test.pdf") # PDF -> Margin problem (cut!)
webshot::webshot("test.html", "test.png") # PNG -> Poorer Quality