polarGlyph: Add Polar Glyph

Description Usage Arguments Details Value See Also Examples

View source: R/polarGlyph.R

Description

Convert data (time series) to polar coordinates, and add circular data as a point (glyph) at a reference point in a figure

Usage

1
2
polarGlyph(x, y, ctr_pt, rad_range = c(0, 2 * pi), g.cex = 1,
  col = "black", lwd = 1, lcol = "black")

Arguments

x, y

numeric coordinates to be converted into circular units

ctr_pt

the point at which to add the glyph

rad_range

numeric range (length 2) for the glyph starting and stopping locations around the circle, in units of radians; default is a full circle, with starting point at 3 o'clock;

g.cex

numeric (positive value) multiplicative glyph expansion; glyph size is tied to character size, hence cex. Values above 1 increase circle radius.

col

fill color for glyph

lwd

line width for (semi-) circle outlining glyph perimeter at maximum value (radius)

lcol

the color of the line outline the glyph

Details

The glyph represents a time series that is plotted with a filled color between the time series line and the x-axis, then that polygon is wrapped around a centroid (the reference point).

The parameter rad_range controls how far around the centroid the glyph is wrapped, and the location of the start and end points. The values should be in increasing order, and the glyph is plotted in a counterclockwise direction. Use of this convention is not checked, and may produce surprising results if the radius range is not supplied accordingly.

Value

Invisibly returns NULL

See Also

For another approach to adding miniaturized time series data to a specific location on a figure, see sparklines.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
x <- sample(1:75, 50)
y <- cumsum(rnorm(50))[rank(x)] + x*0.05
ctr_pt <- c(x[30], y[30])
g.cex <- 0.75
bcol <- adjustcolor("blue", 0.5)
rcol <- adjustcolor("red", 0.5)
rr1 <- c(0.5*pi,pi*1.5)
rr2 <- c(1.5*pi,pi*2.5)

dev.new()
plot(x[order(x)],y[order(x)],type='l')
polarGlyph(x, y, ctr_pt, rad_range=rr1, g.cex=1, col=rcol, lwd=1, lcol="red")
polarGlyph(x, y, ctr_pt, rad_range=rr2, g.cex=1, col=bcol, lwd=1, lcol='blue')

rBatt/rbLib documentation built on May 26, 2019, 7:45 p.m.