Learn R Programming

⚠️There's a newer version (0.4.1) of this package.Take me there.

rvg package

  • SVG (Scalable Vector Graphics) with dsvg. The graphic can be made interactive (tooltip, onclick and id attribute manipulation). To make that work in an HTML document, check for dependencies d3.js in the document. This is the svg device used by package ggiraph.
  • DrawingML for Microsoft PowerPoint with dml_pptx and for Microsoft Excel with dml_xlsx. Theses formats let users edit the graphic elements (editable graphics) within PowerPoint or Excel and have a very good rendering.

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. By default, theses graphics are editable, element edition can be disabled with option editable = FALSE. For more details, read officer article graphics.

library(rvg)
library(ggplot2)
library(officer)

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")

Installation

Install the development version:

devtools::install_github("davidgohel/rvg")

Install the CRAN version:

install.packages("rvg")

Copy Link

Version

Install

install.packages('rvg')

Monthly Downloads

28,758

Version

0.1.5

License

GPL-3

Issues

Pull Requests

Stars

Forks

Maintainer

David Gohel

Last Published

September 5th, 2017

Functions in rvg (0.1.5)

dml_pptx

DrawingML graphic device for Microsoft PowerPoint
body_add_vg

add a plot output as vector graphics into a Word object
ph_with_vg

add a plot output as vector graphics into a PowerPoint object
rvg_tracer_off

trace off id colection
dsvg

SVG Graphics Driver
dsvg_view

Run plotting code and view svg in RStudio Viewer or web broswer.
dml_xlsx

DrawingML graphic device for Microsoft Excel
dml_docx

DrawingML graphic device for Microsoft Word
set_attr

set attributes to graphical elements
rvg_tracer_on

trace on id colection