grVizToPNG | R Documentation |
Export an htmlwidget
object (produced by DiagrammerR::grViz
) into a PNG file
grVizToPNG(g, width = NULL, height = NULL, folder = ".", filename)
g |
an object produced by the |
width |
the width in pixels of the bitmap |
height |
the height in pixels of the bitmap |
folder |
path to folder where the PNG file should stored |
filename |
an optional filename.
If not provided, the filename will be derived from the name
of the argument of |
First the grViz
object is exported to an SVG file (using DiagrammeRsvg::export_svg
).
Then the SVG file is converted to a bitmap (using rsvg::rsvg
).
Then the bitmap is exported as a PNG file (using png::writePNG
).
Note that the SVG file and the PNG file will be named using the name of the g
parameter
Returns the full path of the PNG file.
In addition to the DiagrammmeR package, the following packages are used: DiagrammeRsvg
, rsvg
Nick Barrowman
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.