isAnnotationGroup: Determine if an SVG element is made up of sub-elements...

Description Usage Arguments Value Author(s) See Also Examples

Description

When we decorate an R plot with calls to functions such as lines, abline, text, symbols and so on, these appear in the resulting SVG in a separate group (<g>) element. This function allows us to determine if such a group is made up of SVG child elements that are physically/geographically located within another region's area, i.e. located within the bounding box of the parent node. If they are, this is likely to be a collection of decorations.

Usage

1
isAnnotationGroup(g, parent, bbox = getBoundingBox(parent), scalar = TRUE)

Arguments

g

an SVG element whose children are tested to determine which objects

parent

the parent SVG element of whom we are querying whether the elements in g are inside this element's bounding box

bbox

the bounding box object of the parent which can be specified without a parent if it has already been computed

scalar

a logical value indicating whether we want a single predicate value indicating whether all of the elements are inside the bounding box, or alternatively a vector with a logical value for each of the child nodes of g indicating which are and which aren't contained in parent's bounding box.

Value

A logical value.

Author(s)

Duncan Temple Lang

See Also

isInside getBoundingBox

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
doc = svgPlot({
           plot(1:10, pch = '+', bg = c("red"), fg = "blue")
           abline(v = c(3, 7), col = 'blue', lty = 3)
           abline(h = c(3, 7, 9), col = 'lightgray', lty = 2)           
        })

r = getPlotRegionNodes(doc)
length(r)  # 1 and they are just the lines.

SVGAnnotation:::isAnnotationGroup(r[[2]], r[[1]])

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