Last data update: 2014.03.03

R: Functions to plot circular related figures
pointsCircleR Documentation

Functions to plot circular related figures

Description

Functions to plot circular related figures

Usage

linesCircle(radius, center.x = 0, center.y = 0, edges = 300, ...)
polygonDisk(radius, center.x = 0, center.y = 0, edges=300,
...)
arrowsArc(theta0, theta1, radius, center.x = 0, center.y = 0, edges = 10,
          length = 0.25, angle = 30, code = 2, ...)
pointsArc(theta0, theta1, radius, center.x = 0, center.y = 0, ...)
linesArc(theta0, theta1, radius, center.x = 0, center.y = 0, ...)
polygonArc(theta0, theta1, radius.in, radius.out,
           center.x = 0, center.y = 0,
           edges = 10,
           col = "black",
           border = NA,
           ...)

Arguments

theta0, theta1

start and end angles for the arc

radius

radius of the circle

radius.in

inner radius

radius.out

outer radius

center.x, center.y

Coordinates for the center of the circle (default to (0, 0))

edges

number of edges the shape is made of

col

color

border

border (see polygon)

length, angle, code

see the corresponding parameters for the function arrows

...

optional graphical paramaters

Details

Details to come... for now the best to run the examples and experiment by yourself...

Value

Function only used for their border effects.

Author(s)

laurent

Examples

par(mfrow=c(2,2))
n <- 10
thetas <- rev(seq(0, 2 * pi, length=n))

rhos <- rev(seq(1, n) / n)

xy <- polar2xy(rhos, thetas)
colo <- heat.colors(n)

plot(0, 0, xlim=c(-2, 2), ylim=c(-2, 2), type="n")
for (i in 1:n)
  linesCircle(rhos[i]/2, xy$x[i], xy$y[i])

plot(0, 0, xlim=c(-2, 2), ylim=c(-2, 2), type="n")
for (i in 1:n)
  polygonDisk(rhos[i]/2, xy$x[i], xy$y[i], col=colo[i])

plot(0, 0, xlim=c(-2, 2), ylim=c(-2, 2), type="n", xlab="", ylab="")
for (i in 1:n)
  polygonArc(0, thetas[i],
             rhos[i]/2, rhos[i],
             center.x = xy$x[i], center.y = xy$y[i], col=colo[i])

plot(0, 0, xlim=c(-2, 2), ylim=c(-2, 2), type="n", xlab="", ylab="")
for (i in (1:n)[-1]) {
  linesCircle(rhos[i-1], col="gray", lty=2)
  polygonArc(thetas[i-1], thetas[i],
             rhos[i-1], rhos[i], col=colo[i],
             edges=20)
  arrowsArc(thetas[i-1], thetas[i],
             rhos[i] + 1, col=colo[i],
             edges=20)
}
  

Results


R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(ecolitk)
> png(filename="/home/ddbj/snapshot/RGM3/R_BC/result/ecolitk/pointsCircle.Rd_%03d_medium.png", width=480, height=480)
> ### Name: pointsCircle
> ### Title: Functions to plot circular related figures
> ### Aliases: linesCircle polygonDisk arrowsArc pointsArc linesArc
> ###   polygonArc
> ### Keywords: aplot
> 
> ### ** Examples
> 
> par(mfrow=c(2,2))
> n <- 10
> thetas <- rev(seq(0, 2 * pi, length=n))
> 
> rhos <- rev(seq(1, n) / n)
> 
> xy <- polar2xy(rhos, thetas)
> colo <- heat.colors(n)
> 
> plot(0, 0, xlim=c(-2, 2), ylim=c(-2, 2), type="n")
> for (i in 1:n)
+   linesCircle(rhos[i]/2, xy$x[i], xy$y[i])
> 
> plot(0, 0, xlim=c(-2, 2), ylim=c(-2, 2), type="n")
> for (i in 1:n)
+   polygonDisk(rhos[i]/2, xy$x[i], xy$y[i], col=colo[i])
> 
> plot(0, 0, xlim=c(-2, 2), ylim=c(-2, 2), type="n", xlab="", ylab="")
> for (i in 1:n)
+   polygonArc(0, thetas[i],
+              rhos[i]/2, rhos[i],
+              center.x = xy$x[i], center.y = xy$y[i], col=colo[i])
> 
> plot(0, 0, xlim=c(-2, 2), ylim=c(-2, 2), type="n", xlab="", ylab="")
> for (i in (1:n)[-1]) {
+   linesCircle(rhos[i-1], col="gray", lty=2)
+   polygonArc(thetas[i-1], thetas[i],
+              rhos[i-1], rhos[i], col=colo[i],
+              edges=20)
+   arrowsArc(thetas[i-1], thetas[i],
+              rhos[i] + 1, col=colo[i],
+              edges=20)
+ }
>   
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>