linesTorus: Lines and arrows with wrapping in the torus

View source: R/auxiliary.R

linesTorusR Documentation

Lines and arrows with wrapping in the torus

Description

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

Usage

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

Arguments

x

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

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

x and y are wrapped to [-\pi,\pi) before plotting.

Value

Nothing. The functions are called for drawing wrapped lines.

Examples

x <- toPiInt(rnorm(50, mean = seq(-pi, pi, l = 50), sd = 0.5))
y <- toPiInt(x + rnorm(50, mean = seq(-pi, pi, l = 50), sd = 0.5))
plot(x, y, xlim = c(-pi, pi), ylim = c(-pi, pi), col = rainbow(length(x)),
     pch = 19)
linesTorus(x = x, y = y, col = rainbow(length(x)), ltyCross = 2)
plot(x, y, xlim = c(-pi, pi), ylim = c(-pi, pi), col = rainbow(length(x)),
     pch = 19)
linesTorus(x = x, y = y, col = rainbow(length(x)), arrows = TRUE)

egarpor/sdetorus documentation built on March 4, 2024, 1:23 a.m.