R, Tutorial

Keeping beautiful R graphs beautiful in PowerPoint

Over the past few years I have fallen in love with graphs made with R. They can be as beautiful as your imagination can make them. When converted to .pdf, thanks to vector graphics, they stay crisp at any size.

Unfortunately, it is not always easy to preserve this beauty when I want to publish these graphs or show them in professional presentations. Yes, all the glories of R graphics are preserved perfectly using knitr + Latex + Beamer + Slidify. However, I have many presentations that I have painstakingly prepared in PowerPoint. If I want to add just one new image to such a presentation, it would be very difficult to remake the whole presentation in a different format. Furthermore, almost no Psychology journals accept Latex documents.

Because I was unaware of a better solution, I have made graphics in R, converted them to .pdf, used Adobe Reader’s snapshot tool to copy the images (zoomed to 200%), and pasted the images as bitmaps in PowerPoint or Word. The images look okay but they are not truly scalable. It has been disappointing to see them lose image quality.

MS Office documents have a scalable vector format for images called enhanced metafile (.emf). R has the ability to save graphics as enhanced metafiles but the results are ugly (no anti-aliasing).

The best (free) solution I have found so far is to save graphics made in R as scalable vector graphics (.svg), open them in Inkscape (a free alternative to Adobe Illustrator), saving them as enhanced metafiles (.emf), and importing them into PowerPoint or Word. The results are (nearly) perfect! The only flaws I have identified so far is that semi-transparent colors become opaque and some lines with flat endings become lines with rounded endings. In most cases, I am very satisfied with the results.

Also, enhanced metafiles usually have extremely large file sizes when made in PowerPoint. However, when made in R the .emf file sizes have been very reasonable.


5 thoughts on “Keeping beautiful R graphs beautiful in PowerPoint

  1. I found the same solution as you, long ago. I stumbled upon this page while hoping to find some way to turn anti-aliasing on in Office programs. Thanks for sharing this article; it isn’t what I wanted but it would have saved me a lot of time if I had read it last year. Inkscape is how I draw charts and they come out a lot better than if I had drawn them with my lower degree of powerpoint skils.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s