enlargeSVGViewBox: Enlarge the viewing area/dimensions of an SVG file

Description Usage Arguments Value Author(s) References See Also Examples

Description

This function is a high-level interface to changing the dimensions of the SVG document. It is mostly used, so far, to enlarge the view of an SVG display created in R so that we can add extra elements when post-processing the document. For example, to add a slider below on the side of a plot we must enlarge the viewing area in the appropriate dimension.

Usage

1
enlargeSVGViewBox(doc, x = 0, y = 0, svg = xmlRoot(doc))

Arguments

doc

the parsed XML/SVG document

x

the amount to add to the width of the SVG document's viewing area

y

the amount to add to the height of the SVG document's viewing area

svg

the root node whose width and height attributes are to be modified

Value

The updated SVG document, invisibly.

Author(s)

Duncan Temple Lang

References

http://www.carto.net/papers/svg/samples/index.shtml#iact

See Also

addSlider

Examples

1
2
3
4
5
6
7
8
9
  doc = svgPlot(plot(1:10))
  enlargeSVGViewBox(doc, 100, 200)
  g = xmlRoot(doc)[["g"]]
  newXMLNode("text", "Horizontal",
              attrs = c(x = 250, y  = 600, fill = "red"),
             parent = g)
  newXMLNode("text", "Vertical",
              attrs = c(x = 550, y  = 250, fill = "blue"),
             parent = g)

duncantl/SVGAnnotation documentation built on May 15, 2019, 5:57 p.m.