Hi all,

To my knowledge, the current version of contour.default() does not handle the 'asp' parameter. This can be embarassing when displaying eg geographical maps, etc... Submitted to the opinion of more experienced R programmers, contour.defaut() function should be changed according to the followings:

line 7: add = FALSE,asp=NA,...)
line 33: plot.window(xlim, ylim, asp=asp,"")

The new script would be:

contour.default<-
function (x = seq(0, 1, len = nrow(z)), y = seq(0, 1,
len = ncol(z)),z, nlevels = 10, levels = pretty(zlim, nlevels), labels = NULL, xlim = range(x, finite = TRUE), ylim = range(y, finite = TRUE),
    zlim = range(z, finite = TRUE), labcex = 0.6, drawlabels = TRUE,
    method = "flattest", vfont = c("sans serif", "plain"), axes = TRUE,
    frame.plot = axes, col = par("fg"), lty = par("lty"), lwd = par("lwd"),
    add = FALSE,asp=NA,...)
{
    if (missing(z)) {
        if (!missing(x)) {
            if (is.list(x)) {
                z <- x$z
                y <- x$y
                x <- x$x
            }
            else {
                z <- x
                x <- seq(0, 1, len = nrow(z))
            }
        }
        else stop("no `z' matrix specified")
    }
    else if (is.list(x)) {
        y <- x$y
        x <- x$x
    }
    if (any(diff(x) <= 0) || any(diff(y) <= 0))
        stop("increasing x and y values expected")
    if (!is.matrix(z) || nrow(z) <= 1 || ncol(z) <= 1)
        stop("no proper `z' matrix specified")
    if (!add) {
        plot.new()
        plot.window(xlim, ylim, asp=asp,"")
        title(...)
    }
    if (!is.double(z))
        storage.mode(z) <- "double"
    method <- pmatch(method[1], c("simple", "edge", "flattest"))
    if (!is.null(vfont))
        vfont <- c(typeface = pmatch(vfont[1], Hershey$typeface) -
            1, fontindex = pmatch(vfont[2], Hershey$fontindex))
    if (!is.null(labels))
        labels <- as.character(labels)
    .Internal(contour(as.double(x), as.double(y), z, as.double(levels),
        labels, labcex, drawlabels, method, vfont, col = col,
        lty = lty, lwd = lwd))
    if (!add) {
        if (axes) {
            axis(1)
            axis(2)
        }
        if (frame.plot)
            box()
    }
    invisible()
}
<environment: namespace:base>




Best regards,

Patrick
	[[alternative HTML version deleted]]


