display_svg | R Documentation |
Display SVG on standard graphic display port
display_svg(svg, width = NULL, height = NULL)
svg |
XML document with SVG content. |
width |
Desired width (in px) of image (default NULL). |
height |
Desired height (in px) of image (default NULL). |
Viewport depends on system and IDE. In RStudio the image is displayed under 'Viewer'.
If neither width nor height are specified the image will have its size depending on DPI settings. If only one of these is specified, the other one is scaled accordingly.
#read SVG file
fpath <- system.file("extdata", "fig1.svg", package="svgtools")
svg <- read_svg(file = fpath)
#display SVG file in standard viewport
display_svg(svg = svg, width = 500)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.