diff --git a/R/PlotEquiMap.R b/R/PlotEquiMap.R index ee10ec3aa4f2c42947f1b286b03a4f1e4d683bbf..640533399ebb5ca5d485c11fa9edfb1954d245b2 100644 --- a/R/PlotEquiMap.R +++ b/R/PlotEquiMap.R @@ -748,9 +748,10 @@ PlotEquiMap <- function(var, lon, lat, varu = NULL, varv = NULL, # ~~~~~~~~~~~~~~~~~ # latb <- sort(lat, index.return = TRUE) - dlon <- lon[2:dims[1]] - lon[1:(dims[1] - 1)] + dlon <- diff(lon) wher <- which(dlon > (mean(dlon) + 1)) if (length(wher) > 0) { + warning("Detect gap in 'lon' vector, which is considered as crossing the border.") lon[(wher + 1):dims[1]] <- lon[(wher + 1):dims[1]] - 360 } lonb <- sort(lon, index.return = TRUE) @@ -942,7 +943,7 @@ PlotEquiMap <- function(var, lon, lat, varu = NULL, varv = NULL, # Plotting continents # ~~~~~~~~~~~~~~~~~~~~~ # - wrap_vec <- c(lon[1], lon[1] + 360) + wrap_vec <- c(lonb$x[1], lonb$x[1] + 360) old_lwd <- par('lwd') par(lwd = coast_width) # If [0, 360], use GEOmap; if [-180, 180], use maps::map