ignore: Ignores useless objects

View source: R/ignore.R

ignoreR Documentation

Ignores useless objects

Description

Ignores useless objects: this function will discard the polygons or polylines outside a certain range. This allows to avoid unnecessary work for multigons(), multilines(), centresvg() and framesvg().

Usage

ignore(
  i,
  x,
  y = NA,
  d = list(),
  j = unique(i),
  arg = list(),
  xlim = par("usr")[c(1, 2)],
  ylim = par("usr")[c(3, 4)],
  xlog = par("xlog"),
  ylog = par("ylog")
)

Arguments

i

a polygon id for each x and y coordinate. If n objects are provided there should be n unique ids describing them, and the graphical parameters should be of length 1 or n.

x, y

numeric vectors of coordinates.

d

a list of named vectors going with i, x and y

j

a list of the ids in the order used for the arg arguments. By default they are in their order of appearance in i

arg

a list of arguments f length 1 or n.

xlim, ylim

the limits in x and y; if any object has all his points past one of these limits, it will be removed.

xlog, ylog

whether the axes have logarithmic scale

Value

a list of i, x, y, d, j and arguments.

See Also

Tributary functions: multigons, multilines, centresvg and framesvg

Examples

i <- c(rep("A1",6), rep("A2",6), rep("A3",6))
x <- c(1,2,3,3,2,1,4,5,6,6,5,4,7,8,9,9,8,7)
y <- c(1,2,3,4,5,6,1,2,3,4,5,6,1,2,3,4,5,6)

xlim <- c(2,5)
ylim <- c(0,1.5)

plot(c(0,10),c(0,10),type = "n")
rect(xlim[1], ylim[1], xlim[2], ylim[2])

multilines(i, x, y, lty = 3, col = "grey80")

res <- ignore(i, x, y, arg = list(lty =  1, lwd = 3,
              col = c("orange", "green", "red")),
              xlim = xlim, ylim = ylim)

do.call(multilines, res)


StratigrapheR documentation built on July 9, 2023, 6:02 p.m.