annulusSeg: Plot an annulus with different segments on an existing plot

View source: R/annulusSeg.r

annulusSegR Documentation

Plot an annulus with different segments on an existing plot

Description

This function adds an annulus to an existing plot. It is very similar to the annulus function except that the annulus can be composed of one or more "segments" with different formatting (color, etc.).

Usage

annulusSeg(
  x,
  y,
  inner,
  outer,
  deg = NULL,
  n = 1000,
  col = "black",
  density = NULL,
  angle = 45,
  border = col,
  force0 = FALSE,
  ...
)

Arguments

x

Numeric, x-coordinate of center of annulus.

y

Numeric, y-coordinate of center of annulus.

inner

Numeric vector, inner radius of each segment.

outer

Numeric vector, outer radius of each segment.

deg

This is either:

  • A numeric vector with one value per segment. The values will be standardized, then each segment will compose an arc with the number of degrees proportional to the value relative to the sum of values.

  • A two-column matrix or data frame with numeric values. Each row pertains to one segment. The first column gives the starting degree for the segment and the second column the ending degree. Zero degrees is "north" and increasing values go clockwise.

  • NULL (default), in which case each segment covers an equal number of degrees (same as the first option where each value is equal to the rest).

n

Integer, number of vertices used to approximate a circle.

col

Character or integer vector, colors used to fill segments.

density

Numeric or numeric vector, the density of shading lines, in lines per inch. The default value of NULL causes no shading lines to be drawn. A zero value of density means no shading nor filling whereas negative values and NA suppress shading (and so allow color filling).

angle

Numeric or numeric vector, the slope of shading lines, given as an angle in degrees (counter-clockwise).

border

Character or integer vector, color used to draw segment borders.

force0

Logical, if TRUE then negative values of inner and outer are coerced to equal 0. If FALSE (default) then throws an error.

...

Arguments to send to polygon.

Value

Nothing (side-effect is to add a segmented annulus to an existing plot).

See Also

annulus, polygon

Examples

inner <- c(0.2, 0.4, 0.7)
outer <- c(0.5, 0.6, 0.71)
col <- c('red', 'blue', 'green')
par(pty='s')
plot(0, 0, xlim=c(-1, 1), ylim=c(-1, 1), col='white')
annulusSeg(x=0, y=0, inner, outer, col=col, border='black')

adamlilith/legendary documentation built on July 28, 2023, 8:13 p.m.