annulus: Plot an annulus on an existing plot.

View source: R/annulus.r

annulusR Documentation

Plot an annulus on an existing plot.

Description

This function adds an annulus to an existing plot.

Usage

annulus(
  x,
  y,
  inner,
  outer,
  deg = c(0, 360),
  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, inner radius.

outer

Numeric, outer radius.

deg

Two-element numeric list, degrees across which to draw the annulus (0 is "north" and increasing values go clockwise). Default is c(0, 360).

n

Integer, number of vertices used to approximate a circle.

col

Character or integer, color used to fill annulus. Note that if col and border are different colors and deg is c(0, 360) (the default), then you will able to see the line connecting the inner and outer borders.

density

Numeric, 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, the slope of shading lines, given as an angle in degrees (counter-clockwise).

border

Character or integer, color used to draw annulus border. Note that if col and border are different colors and deg is c(0, 360) (the default), then you will able to see the line connecting the inner and outer borders.

force0

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

...

Arguments to send to polygon.

Value

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

See Also

annulusSeg, polygon

Examples

par(pty='s')
plot(0, 0, xlim=c(-1, 1), ylim=c(-1, 1))
annulus(x=0.3, y=-0.2, inner=0.3, outer=1, col='cornflowerblue')
annulus(x=-0.3, y=0.2, inner=0.2, outer=0.4, deg=c(0, 135), border='red')

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