How can I fill an entire PowerPoint slide with an R plot? I'd like to use vector graphics (otherwise screenshot and crop would be a solution). I'd also like to avoid manual touches.
The following code (grabbed from this post) does a perfectly fine job of filling the "Content" of a "Title and Content" slide.
library( ReporteRs )
require( ggplot2 )
mydoc = pptx( )
mydoc = addSlide( mydoc, slide.layout = "Title and Content" )
mydoc = addTitle( mydoc, "Plot examples" )
myplot = qplot(Sepal.Length, Petal.Length
, data = iris, color = Species
, size = Petal.Width, alpha = I(0.7)
)
mydoc = addPlot( mydoc, function( ) print( myplot ), vector.graphic=TRUE)
writeDoc( mydoc, file = "test plot.pptx" )
I thought I might be able to fill an entire slide using the following code:
library( ReporteRs )
require( ggplot2 )
mydoc = pptx( )
mydoc = addSlide( mydoc, slide.layout = "Blank" )
#mydoc = addTitle( mydoc, "Plot examples" )
myplot = qplot(Sepal.Length, Petal.Length
, data = iris, color = Species
, size = Petal.Width, alpha = I(0.7)
)
mydoc = addPlot( mydoc, function( ) print( myplot ), vector.graphic=TRUE)
writeDoc( mydoc, file = "test plot.pptx" )
But, i get the error message:
Error in next_shape_pos(doc) :
shape of type 'plot' has no more room left to be displayed in the layout
I think there may be a solution where I create new PowerPoint slide layout with content filling the entire slide and then save as a PowerPoint template? But I'm not very familiar with this stuff and am starting to feel like I'm missing something obvious.