I have created a plot in R, and exported it as a vector object in a powerpoint slide (pptx file), using the "rvg" and "officer" packages (see code below).
I would like to define the dimensions (height and width) of the slides in the pptx create by the code, but I cannot see an option to do this. It is possible to specify the size of the plot object exported, but not the size of the powerpoint slide size.
Is it possible to define the size of the powerpoint slide when exporting a plot from R into a pptx file?
Many thanks for advice/help
#EXAMPLE CODE
#IMPORT LIBRARIES
library(officer)
library(rvg)
#MAKE RANDOM DATA
x<-rnorm(50,1,10)
y<-rnorm(50,2,20)
#WRAP PLOT CODE IN A FUNCTION
plot.code<-function(){
plot(x,y)
}
#CREATE AND EXPORT PPTX FILE
export.plot<-read_pptx()
export.plot <- add_slide(export.plot, "Title and Content", "Office Theme")
export.plot<-ph_with_vg(export.plot,code=plot.code(),type="body",height=10,width=10)
#height and width in the above code define the size of the plot, not the slide
print(export.plot, target = "export.plot.pptx")