How to export a ggplot object to a editable powerpoint file ?

Microsoft powerpoint is a versatile software for making illustrations for the academic literature.  It has easy to use and powerful shape editing features which allow making useful and attractive graphics.

Data visualization software often export the plots in JPEG, PDF or TIFF formats . These formats are non-editable in the powerpoint software but an user always need to do some final editing to make the plot compatible with the over-all manuscript. In this case, it will be useful if an user can export the plot as an editable powerpoint from the graphics software. Fortunately, it is possible to do that in R.  Thanks to David Gohel (link)  for developing the officer package. Any ggplot (link) or R-graphics object now can be exported as a fully-editable powerpoint. Here is the example code.  Credit – David – link

[sourcecode language="r"]
install.packages("pacman")# Package manager for easy installation and loading of R-libraries. 
pacman::p_load(gridExtra,ggplot2,officer,magrittr,rvg,flextable,ggplot2) # needed packages.  

read_pptx() %>% 
add_slide(layout = "Title and Content", master = "Office Theme") %>% 
ph_with_vg(code = print(p1), type = "body", width = 10,height = 7, offx = .3, offy = .3) %>% 
print(target = "p1.pptx") %>% 
invisible()
[/sourcecode]

In this code, p1 is the ggplot object which get exported to p1.pptx. Ph_with_vg command converts the object to a support vector graphics (SVG) format and then add it into the pptx file. You can replace p1 with your ggplot object and use the code. You have to ungroup (link) the graphic in the powerpoint software so it gets converted to shapes which you can edit.

I have been using this feature for my ChemRICH software which explorts a bubble chart as a pptx. PhD and post-doctoral fellows in the lab love this feature.