ggsave in ggplot (3.3.4) generates this error:
Error in grDevices::win.metafile(...) : unused argument (bg = "white")
However, I can export the plot interactively using the RStudio | Plots menu.
reproducible example:
library(tidyverse)
e <- ggplot(mpg, aes(cty, hwy))
e + geom_point()
ggsave("test.wmf")
ggsave("test.emf")
Saving 8.98 x 5.98 in image
Error in grDevices::win.metafile(...) : unused argument (bg = "white")
ggsave("test.emf")
Saving 8.98 x 5.98 in image
Error in grDevices::win.metafile(...) : unused argument (bg = "white")
Some further trouble-shooting suggests that the problem is with ggsave because this code works fine:
library(tidyverse)
e <- ggplot(mpg, aes(cty, hwy))
e <- e + geom_point()
win.metafile("test.wmf")
print(e)
dev.off()