Skip to contents

Plot JamPolygon object

Combine multiple JamPolygon objects, given two JamPolygon or multiple objects in a list.

Usage

# S4 method for class 'JamPolygon,ANY,ANY,ANY'
x[i, j, ..., drop = TRUE]

# S4 method for class 'JamPolygon,missing'
plot(x, y, ...)

rbind2.JamPolygon(x, y, ...)

# S4 method for class 'JamPolygon,ANY'
rbind2(x, y, ...)

Arguments

x, y

JamPolygon object

...

additional JamPolygon objects if present

Value

JamPolygon object, invisibly.

Details

This function is intended to support input as rbind2(list(JamPolygons)) or do.call(rbind2.JamPolygon, list(JamPolygons)) with any combination of one or more JamPolygon objects.

Examples

dfx <- data.frame(name=c("polygon1", "polygon2"),
   x=I(list(
      list(c(1, 4, 4, 1),
         c(2, 3, 3, 2)),
      c(5, 6, 6, 5))),
   y=I(list(
      list(c(1, 1, 4, 4),
         c(2, 2, 3, 3)),
      c(1, 1, 2, 2))),
   fill=c("gold", "firebrick"))
jpx <- new("JamPolygon", polygons=dfx);
plot(jpx);


dfz <- data.frame(name=c("polygon1", "polygon2", "polygon3"),
   x=I(list(
      list(c(1, 4, 4, 1),
         c(2, 3, 3, 2)),
      list(c(4.5, 6.5, 6.5, 4.5),
         c(5, 6, 6, 5)),
      list(c(1, 4, 4, 1),
         c(2, 3, 3, 2),
         c(5, 6, 6, 5)))),
   y=I(list(
      list(c(1, 1, 4, 4),
         c(2, 2, 3, 3)),
      list(c(1, 1, 3, 3),
         c(3, 3, 4, 4)+0.5),
      list(c(5, 5, 8, 8),
         c(6, 6, 7, 7),
         c(6, 6, 7, 7)))),
   fill=c("gold", "firebrick", "dodgerblue"));
jpz <- new("JamPolygon", polygons=dfz);
jpz@polygons[, c("label_x", "label_y")] <- as.data.frame(labelr_JamPolygon(jpz))
jpz@polygons$border <- c("orange", "gold", "purple");
jpz@polygons$border.lwd <- c(3, 4, 5);
jpz <- add_orientation_JamPolygon(jpz);
plot(jpz);