R ggplots with anti-aliasing and wmf format on windows

288 views Asked by At

I'm trying to export a ggplot to word as an windows metafile on windows platform. Some suggest cairo to remove aliasing, but I need to save the plot as windows metafile, which don't work with wmf. ggsave(plot=plot,filename="plot.wmf",type="cairo")

gives

Error in grDevices::win.metafile(...) : unused argument (type = "cairo")

Do anyone have a solution?

1

There are 1 answers

1
Brody On

Take a look at the ggsave documentation as it appears you're missing an argument. Looks like you need both a plot and a filename, and the cairo type isn't specified.

From what you have: ggsave(plot.wmf,type="cairo")

To something like: ggsave(plot = plot.wmf, "plot.wmf", type ="cairo-wmf")

More help from this resource: https://gist.github.com/dsparks/3777731