Opiniomics

bioinformatics, genomes, biology etc. "I don't mean to sound angry and cynical, but I am, so that's how it comes across"

Easy and powerful graph editing using R and PowerPoint

A recent conversation on Twitter reminded me of a powerful way to edit graphs created in R inside PowerPoint:

I realise that R is incredibly powerful anyway, and that much of this can be done within R, but I am also painfully well aware that R is hard, and that many users prefer “point-and-click”.

This example uses Windows.

1. In R, let’s create a graph:

data(iris)
plot(iris$Sepal.Length, iris$Sepal.Width, main="My Graph", xlab="Width", ylab="Length")

2. You should see something like the graph below.  In the top left hand corner, choose File -> Save As -> Metafile, and save it somewhere convenient

mygraph3. Now, fire up PowerPoint and start with a blank slide.  Choose insert picture

insertpictureNavigate to the .emf file you just saved and choose it.  You should see:

inserted4. Now, right click the image, choose group -> ungroup:

ungroupYou will get a message asking if you want to convert the image to a Microsoft Drawing object.  Choose yes:

drawingobj

5. Now repeat step 4. Right click the image, choose group -> ungroup:

ungroupYou should now see something like this:

editableEvery single part of the graph is now selectable, moveable and editable!  Click outside of the chart area to de-select everything, and then click on individual components to edit them.  In the graph below I have changed the title, and given one of the data points a red background:

edited

Enjoy!

(I realise there are other ways to do this, perhaps better ways e.g. export as PDF then edit in Illustrator (thanks !  This post is really aimed at those familiar and comfortable with PowerPoint :-))

2 Comments

  1. Just be careful not to accidentially move some of the data points!

  2. One of my most popular post was about boxplots in Excel – mere mortals understand Microsoft

Leave a Reply

Your email address will not be published.

*

*

code

© 2017 Opiniomics

Theme by Anders NorenUp ↑