xmlSVG: Run plotting code and return svg

Description Usage Arguments Value Examples

View source: R/inlineSVG.R

Description

This is useful primarily for testing. Requires the xml2 package.

Usage

1
xmlSVG(code, ..., standalone = FALSE, height = 7, width = 7)

Arguments

code

Plotting code to execute.

...

Other arguments passed on to svglite.

standalone

Produce a standalone svg file? If FALSE, omits xml header and default namespace.

height

Height and width in inches.

width

Height and width in inches.

Value

A xml2::xml_document object.

Examples

1
2
3
4
5
if (require("xml2")) {
  x <- xmlSVG(plot(1, axes = FALSE))
  x
  xml_find_all(x, ".//text")
}

Example output

Loading required package: xml2
{xml_nodeset (2)}
[1] <text x="251.72" y="485.28" style="font-size: 12.00px; font-family: Liber ...
[2] <text transform="translate(12.96,248.14) rotate(-90)" style="font-size: 1 ...

svglite documentation built on Sept. 12, 2017, 1:04 a.m.