Friday, September 20, 2013

Export R ggplot as windows meta file for powerpoint

I want to make a poster with graphs imported from R, using the ggplot package.
  1. I could export the images as png, but they look pixelised on a big file. 
  2. I would have liked to import SVG but it's not possible in microsoft powerpoint. 
  3. win.metafile() is the solution
Took me a while to figure out that the windows metafile is also a scalable graphic format. It can be used as such:
win.metafile("file name.emf",width=17, height=9) # width and height in inches,
# You can divide by 72 to have the size in pixel
ggplot() + geom_line(data=dtf, aes(...))
dev.off()