Vector graphics

One advantage of ReporteRs is that the package let you produce R plot in a vector graphics format. It makes your charts prettier than with raster formats.

Word version should be > 2007 to be able to read these graphics.

This format is not readable by Word 2007. That’s why the argument is set to FALSE with docx objects.

Set argument to TRUE with function addPlot to produce within Word documents.

doc <- docx()
doc <- addPlot( doc, fun = function() plot(sin, -pi, 2*pi), vector.graphic = TRUE )

Editable graphics

Another big advantage of ReporteRs is that these vector graphics images are editable. When the document is edited in Word or PowerPoint application, graphical components like points, lines, text can be modified or even added.

This make possible to let reviewers annotate themself graphics you produced.

Argument editable of function addPlot can be set to FALSE to desable edition of the graph components.


Below an example with a PowerPoint document.

Open the document, zoom in and out on the 2 graphics to see quality differences, then click a text area on the right graphic and modify it.

require( ReporteRs )
require( ggplot2 )
myplot = qplot(Sepal.Length, Petal.Length,
data = iris, color = Species,
size = Petal.Width, alpha = I(0.7) )
# Create a new document
mydoc = pptx( title = "EVG demo" )
mydoc = addSlide( mydoc, "Two Content" )
mydoc = addTitle( mydoc, "Vector graphics format versus raster format" )
mydoc = addPlot( mydoc, function( ) print( myplot ), vector.graphic = TRUE )
mydoc = addPlot( mydoc, function( ) print( myplot ), vector.graphic = FALSE )
filename <- "evg_example.pptx" # the document to produce
writeDoc( mydoc, file = filename )

Download file evg_example.pptx - view with office web viewer