addPolygon: Add a Colored Polygon to a Plot

Description Usage Arguments Examples

View source: R/addPolygon.R

Description

Add a multi-sided polygon to a plot.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
addPolygon(
  x = 0,
  y = 0,
  sides = 72,
  radius = 1,
  rotation = 0,
  border = NULL,
  col = NA,
  ...
)

Arguments

x

x location of center

y

y location of center

sides

number of sides

radius

radius

rotation

amount to rotate the polygon in radians

border

border color (see ?polygon)

col

fill color (see ?polygon)

...

additional arguments to be passed to polygon()

Examples

1
2
3
4
5
6
7
8
# Create AQI dots
plot(1:6, rep(0,6), xlim=c(-1,7), ylim=c(-1,3),
    axes=FALSE, xlab='', ylab='', col='transparent')
for (i in 1:6) {
  addPolygon(i, 2, 72, 0.4, 0, col=PWFSLSmoke::AQI$colors[i])
  addPolygon(i, 1, 4, 0.4, pi/4, co=PWFSLSmoke::AQI$colors[i])
  addPolygon(i, 0, 3, 0.4, pi/2, col=PWFSLSmoke::AQI$colors[i])
}

PWFSLSmoke documentation built on July 8, 2020, 7:19 p.m.