rvg package

Travis-CI Build Status Build status version cranlogs Active

rvg is a set of graphics devices that produces Vector Graphics outputs. This package is providing:

These raw XML outputs cannot be used as is. Functions ph_with_vg() and ph_with_vg_at() can be used with package officer to add vector graphics in PowerPoint documents.


doc <- read_pptx()
doc <- add_slide(doc, layout = "Title and Content", master = "Office Theme")
doc <- ph_with_vg(doc, code = barplot(1:10), type = "body")
print(doc, target = "my_plot.pptx")

Function xl_add_vg() is the equivalent for Excel workbooks.

doc <- read_xlsx()
doc <- xl_add_vg(doc, sheet = "Feuil1", code = print(gg), 
  width = 6, height = 6, left = 1, top = 2 )
print(doc, target = "vg.xlsx")

By default, theses graphics are editable, element edition can be disabled with option editable = FALSE. For more details, read officer article graphics.


You can get the development version from GitHub:


Install the CRAN version: