grVizToImageFile: Export an htmlwidget object into an image file

grVizToImageFileR Documentation

Export an htmlwidget object into an image file

Description

Export an htmlwidget object (produced by DiagrammerR::grViz) into a PNG file

Usage

grVizToImageFile(g, width = NULL, height = NULL, format = "png",
  folder = ".", filename)

Arguments

g

an object produced by the grViz function from the DiagrammmeR package

width

the width in pixels of the bitmap

height

the height in pixels of the bitmap

format

Graphics file format. Currently "png" and "pdf" are supported.

folder

path to folder where the PNG file should stored

filename

an optional filename stem. If not provided, the filename stem will be derived from the name of the argument of g.

Details

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

Value

Returns the full path of the imagefile.

Note

In addition to the DiagrammmeR package, the following packages are used: DiagrammeRsvg, rsvg

Author(s)

Nick Barrowman


nbarrowman/vtree documentation built on Jan. 11, 2024, 5:52 a.m.