asTextNode: Change cairo representation of text to an explicit text...

Description Usage Arguments Author(s) See Also Examples

Description

Text in an SVG document created by R's graphics system(s) and libcairo is represented by a general <g> element. It is sometimes useful to turn these into

Usage

1
2
asTextNode(node, text, replace = TRUE, addChildren = FALSE, ...,
            .attrs = list(...), vertical = NA)

Arguments

node

the original node

text

the text to display in the new <text> element.

replace

a logical value that controls whether we replace the original node

addChildren

a logical value

...

name = value pairs of attributes for the new SVG text node

.attrs

a named list or character vector to use as attributes for the new SVG text node.

vertical

a logical value indicating whether the text is known to be vertical (TRUE) or horizontal (FALSE). Other rotations should be specified in the attributes.

Author(s)

Duncan Temple Lang

See Also

svgPlot svg newXMLNode

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
  doc = svgPlot({
            plot(mpg ~ wt, mtcars, main = "Motor Trend Cars")
          })

  ax = getAxesLabelNodes(doc)
print(ax[[1]])
  newTitle = asTextNode(ax[[1]], "Motor Trend Cars")
  xmlAttrs(newTitle) = c('font-size' = 20)
  newXMLNode("set", attrs = c(attributeName = "text", values = "A, B, C", begin = "1s", dur = "4s"),
               parent = newTitle)
 

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