Learn R Programming

sdetorus (version 0.1.10)

linesCirc: Lines and arrows with vertical wrapping

Description

Joins the corresponding points with line segments or arrows that exhibit wrapping in \([-\pi,\pi)\) in the vertical axis.

Usage

linesCirc(x = seq_along(y), y, col = 1, lty = 1, ltyCross = lty,
  arrows = FALSE, ...)

Value

Nothing. The functions are called for drawing wrapped lines.

Arguments

x

vector with horizontal coordinates.

y

vector with vertical coordinates, wrapped in \([-\pi,\pi)\).

col

color vector of length 1 or the same length of x and y.

lty

line type as in par.

ltyCross

specific line type for crossing segments.

arrows

flag for drawing arrows instead of line segments.

...

further graphical parameters passed to segments or arrows.

Details

y is wrapped to \([-\pi,\pi)\) before plotting.

Examples

Run this code
x <- 1:100
y <- toPiInt(pi * cos(2 * pi * x / 100) + 0.5 * runif(50, -pi, pi))
plot(x, y, ylim = c(-pi, pi))
linesCirc(x = x, y = y, col = rainbow(length(x)), ltyCross = 2)
plot(x, y, ylim = c(-pi, pi))
linesCirc(x = x, y = y, col = rainbow(length(x)), arrows = TRUE)

Run the code above in your browser using DataLab