pathToCircle: Convert generic path SVG node to a circle

Description Usage Arguments Value Author(s) See Also Examples

Description

R's svg function, based on libcairo, draws circles using an SVG (cubic) Bezier path rather than the <circle> element. This function allows us to change such a node to the <circle> representation.

Usage

1
pathToCircle(path, box = getBoundingBox(path), force = FALSE, addTypes = TRUE)

Arguments

path

the <path> node that is to be turned into a <circle> node.

box

the bounding box of the input/source node being converted. This should be of class Circle.

force

a logical value. If the input node does not correspond to a circle, this controls whether we force the conversion anyway.

addTypes

a logical value indicating whether to add a type attribute to the new node with a value of 'plot-point', making it easier to identify in subsequent computations.

Value

The new node or the existing one if it is not suitable for change!

Author(s)

Duncan Temple Lang

See Also

svgPlot

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
doc = svgPlot(plot(1:10))
rr = getPlotRegionNodes(doc)
names(rr[[1]])

pathToCircle(rr[[1]][[1]])

names(rr[[1]])


as(getBoundingBox(rr[[1]]), "Circle")

pathToCircle(rr[[1]]) # silently leaves things unchanged
pathToCircle(rr[[1]], force = TRUE) # silently leaves things unchanged

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