rhombi: Rhombi

View source: R/rhombi.R

rhombiR Documentation

Rhombi

Description

Add rhombi on a plot and returns areas.

Usage

rhombi(x, y = x, ldg = 1, sdg = ldg, rot = 0, add = FALSE, ...)

Arguments

x

a vector of x coordinates of the centers of the losange

y

a vector of y coordinates of the centers of the losange

ldg

vector of length of the large diagonals.

sdg

vector of length of the small diagonals.

rot

rotation angles (in degree) of the rhombi.

add

logical. If TRUE rhombi are added to the current plot (default behavior).

...

additional arguments to be passed to graphics::polygon() function.

Details

The number of rhombus maximal is provided by the length of the largest argument among x, y, ldg, sdg and rot. Other arguments are repeated with the largest length as the desired one (see rep_len()). Additional arguments remain the same for every rhombus.

Value

A vector including rhombi areas is returned if assigned.

Examples

# Example 1:
plot0(asp = 1)
rhombi(0)

# Example 2:
plot0(c(-0.4, 1.4), c(-0.4, 1.4))
rhombi(runif(6), runif(5), runif(2), runif(3))

# Example 3:
plot0(asp = 1)
rhombi(x = 0, rot = seq(0, 180, 20), col = 2, border = NA)
rhombi(x = 0, rot = seq(0, 180, 30), ldg = 0.5, col = 7, border = NA)


inSileco/graphicsutils documentation built on Sept. 12, 2022, 11:13 p.m.