R/plotting-options.R

Defines functions .plotting_options

# Generated by autofun (0.0.0.9000): do not edit by hand!!!
# Please edit source code in spsann-package/R-autofun/plotting-options.R
.plotting_options<-function(...){
expression(if (plotit) {
  par0 <- par()
  on.exit(suppressWarnings(par(par0)))
  if (missing(boundary)) {
    x <- by(candi[, 1], as.factor(candi[, 2]), FUN = range, simplify = FALSE)
    x <- do.call(rbind, x)
    d <- dist(x)
    d <- min(d[d > 0]) / 2
    x[, 1] <- x[, 1] - d
    x[, 2] <- x[, 2] + d
    y <- as.numeric(rownames(x))
    xy <- cbind(c(x[, 1], x[, 2]), rep(y, 2))
    y <- by(candi[, 2], as.factor(candi[, 1]), FUN = range, simplify = FALSE)
    y <- do.call(rbind, y)
    d <- dist(y)
    d <- min(d[d > 0]) / 2
    y[, 1] <- y[, 1] - d
    y[, 2] <- y[, 2] + d
    x <- as.numeric(rownames(y))
    yx <- cbind(rep(x, 2), c(y[, 1], y[, 2]))
    boundary <- unique(rbind(xy, yx))
    rownames(boundary) <- 1:nrow(boundary)
    boundary <- sp::SpatialPoints(boundary)
    rm(x, d, y, xy, yx)
  }
  # I guess this was the reason for the warning message seen by Alexandre Wadoux.
  # It seems that 'rm' should be inside 'if (missing(boundary)) {...}', not outside!!!
  # rm(x, d, y, xy, yx)

  # Open two new plotting devices
  grDevices::dev.new()
  grDevices::dev.new()
})
}
Laboratorio-de-Pedometria/spsann-package documentation built on Nov. 2, 2023, 3:14 p.m.