multilines: Draws several lines

View source: R/multilines.R

multilinesR Documentation

Draws several lines

Description

Draws several polylines or group of points. This function expands on the lines() and points functions from base R graphics. The difference is that several lines and group of points can be drawn in one line by providing an id: i. To each line and group of point you can provide different graphical parameters (i.e. colour, type, etc).

Usage

multilines(
  i,
  x,
  y,
  j = unique(i),
  forget = NULL,
  front = NULL,
  back = NULL,
  type = "l",
  col = "black",
  bg = NA,
  pch = 19,
  lty = par("lty"),
  lwd = par("lwd"),
  cex = par("cex"),
  lend = 0,
  ljoin = 0,
  lmitre = 10
)

Arguments

i

a line id for each x and y coordinate, i.e. the name of each polyline. If you want to give each line a different aspect you should provide a vector of n elements (if you have three lines "A1", "A2" and "A3" with "A2" that should be blue you should provide the colours of all three: e.g. col = c("white", "blue", "white"))

x, y

numeric vectors of x and y coordinates

j

a list of the ids (names) in the order used for the graphical parameters (e.g. colour, shading, etc...). By default they are in their order of appearance in i

forget

the lines that should not be drawn, by their id or index (i.e. name or number of appearance).

front, back

the lines to be put in front and back position, by their id or index (i.e. name or number of appearance). By default the order is the one defined by j, and if j is absent by the order in i.

type

character indicating the type of plotting. For this function it is limited to "l" (lines, is the default), "p" (points) and "o" (points overplotting lines).

col

the color to draw the line. The default is black.

bg

background (fill) color for the open plot symbols given by pch = 21:25.

pch

plotting 'character', i.e., symbol to use. See ?points for further details

lty, lwd

the line type and width, see ?par for details.

cex

haracter (or symbol) expansion: a numerical vector. This works as a multiple of par("cex")

lend, ljoin, lmitre

additional graphical parameters, see ?par for details.

See Also

multigons

Complementary function: shift

Uses ignore to avoid drawing unnecessary objects

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)

plot(c(0,10),c(0,7),type = "n")

multilines(i, x, y, j = c("A3", "A1", "A2"), lty =  c(1,2,3), lwd = 2,
           type = c("l", "o", "o"), pch = c(NA,21,24), cex = 2)


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