write_svg {svgtools}R Documentation

Writes SVG to file

Description

Writes SVG to file

Usage

write_svg(svg, file, remove_hidden = TRUE, flatten = FALSE)

Arguments

svg

XML document with SVG content.

file

Path to file or connection to write to (see write_xml).

remove_hidden

Should hidden elements (with XML attribute display="none") be removed? (default TRUE)

flatten

Should grouping of SVG elements be removed? (default FALSE)

Details

Both remove_hidden=TRUE and flatten=TRUE do not alter the XML document object itself. Therefore, subsequent calls to stackedBar and other functions remain possible.

Examples

#read SVG file
fpath <- system.file("extdata", "fig3.svg", package="svgtools")
svg <- read_svg(file = fpath)

#adjust some elements of SVG
svg <- stackedBar(svg = svg, frame_name = "frame", group_name = "overall", 
                  scale_real = c(0,160), values = c(10,42,106), 
                  alignment = "vertical")

## Not run: 
#write SVG file to disk and remove all groupings
write_svg(svg = svg, file = "myChart.svg", flatten = TRUE)

## End(Not run)

[Package svgtools version 1.1.2 Index]