| Title: | Export DiagrammeR Graphviz Graphs as SVG |
|---|---|
| Description: | Allows for export of DiagrammeR Graphviz objects to SVG. |
| Authors: | Richard Iannone [aut, cre] |
| Maintainer: | Richard Iannone <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 0.1 |
| Built: | 2026-05-26 10:36:43 UTC |
| Source: | https://github.com/rich-iannone/diagrammersvg |
V8
Use viz.js with V8 to get the diagram rendered as SVG
in R instead of the browser.
export_svg(gv)export_svg(gv)
gv |
htmlwidget to render as SVG. |
string of SVG XML text.
## Not run: library(DiagrammeR) svg <- export_svg(grViz('digraph{a->b; c->a; c->b; c->d;}')) # 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)) ## End(Not run)## Not run: library(DiagrammeR) svg <- export_svg(grViz('digraph{a->b; c->a; c->b; c->d;}')) # 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)) ## End(Not run)
This function registers a method for knit_print() for grViz objects.
With this method enabled, rendered HTML documents no longer require
a viz.js dependency.
Instead, embedded SVG is inserted into the Markdown.
The resulting HTML documents have a smaller footprint and are rendered faster.
register_knit_print()register_knit_print()