1# Author: Robert J. Hijmans 2# Date : January 2009 3# Version 1.0 4# Licence GPL v3 5 6 7.extentMatrix <- function(x) { 8 xy <- matrix(NA, nrow=5, ncol=2) 9 xy[c(1,4),1] <- x@xmin 10 xy[2:3,1] <- x@xmax 11 xy[1:2,2] <- x@ymax 12 xy[3:4,2] <- x@ymin 13 xy[5,] <- xy[1,] 14 return(xy) 15} 16 17 18setMethod("plot", signature(x='Extent', y='missing'), 19 function(x, y, type='l', add=FALSE, ...) { 20 xy <- .extentMatrix(x) 21 if (add) { 22 lines(xy, ...) 23 } else { 24 plot(xy, type=type, ...) 25 } 26 } 27) 28 29