library(ggplot2)
ggplot(mtcars, aes(mpg, wt)) + geom_point() +
theme(panel.background = element_rect(fill = "transparent",colour = NA),
plot.background = element_blank())
ggsave("mtcars_66.png", bg = "transparent", type = "cairo-png",width = 20,
height = 15, units = "cm", dpi = 800)
#ref https://stackoverflow.com/questions/49862292/transparent-background-graph-with-ggplot2-in-high-resolution-r