make_circle: Plotting a circle

Description Usage Arguments Author(s) Examples

View source: R/graph.R

Description

Plotting a circle

Usage

1
2
make_circle(center = c(0, 0), radius = 1, nb_step = 300,
  col = "darkblue", fill = NULL, lty = 1)

Arguments

center

A vector of dimension 2 used to denote the center of the circle (default: center = c(0,0)).

radius

A numeric (positive) value used to indicate the radius of the circle (default: raduis = 1).

nb_step

A numeric value used the number of points used to construct the circle (default: nb_step = 300).

col

A numeric or string used to denote the color of the border of the circle (default: col = "darkblue")

fill

A numeric or string used to denote the number the color for filling the circle. The default, NULL, is to leave circle unfilled.

lty

A numeric value used the denote the line type used for the border of the circle (default: lty = 1). See ?par for more details.

Author(s)

Stephane Guerrier

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
# Example 1
plot(NA, xlim = c(-1.1,1.1), ylim = c(-1.1,1.1), xlab = "x", ylab = "y")
grid()
make_square(col = "blue")
make_circle(col = "red", lty = 2)

# Example 2
cols = hcl(h = seq(15, 375, length = 4), l = 65, c = 100)[1:3]
cols_trans = hcl(h = seq(15, 375, length = 4), l = 65, c = 100, alpha = 0.15)[1:3]
plot(NA, xlim = c(-310, 310), ylim = c(-310, 310), xlab = "x", ylab = "y")
grid()
make_circle(fill = "lightgrey", radius = 200, lty = 1)
make_circle(radius = 20, center = c(-300, 300), col = cols[1], fill = cols[1])
make_circle(radius = 20, center = c(300, 300), col =cols[2], fill = cols[2])
make_circle(radius = 20, center = c(0, -300), col = cols[3], fill = cols[3])
make_circle(radius = 449.2136, center = c(-300, 300),
            col = cols[1], fill = cols_trans[1], lty = 2)
make_circle(radius = 284.8427, center = c(300, 300),
            col = cols[2], fill = cols_trans[2], lty = 2)
make_circle(radius = 414.3106, center = c(0, -300),
            col = cols[3], fill = cols_trans[3], lty = 2)

SMAC-Group/ptdspkg documentation built on Oct. 30, 2019, 11:08 p.m.