Learn R Programming

DiagrammeR (version 0.8.1)

exportSVG: Export grViz graph as SVG with V8

Description

Use viz.js with V8 to get the diagram rendered as SVG in R instead of the browser.

Usage

exportSVG(gv)

Arguments

gv
htmlwidget to render as SVG.

Value

  • string of SVG XML text.

Examples

Run this code
library(DiagrammeR)
 (svg <- exportSVG(grViz('digraph{a->b; c->a; c->b; c->d;}',
   engine = 'circo')))

 # this can then be used with htmltools and can save significantly
 # on size of output using svg rather than unrendered grViz
 library(htmltools)
 html_print(HTML(svg))

Run the code above in your browser using DataLab