Index: image.R =================================================================== --- image.R (revision 53953) +++ image.R (working copy) @@ -24,7 +24,8 @@ ylim = range(y), col = heat.colors(12), add = FALSE, xaxs = "i", yaxs = "i", xlab, ylab, - breaks, oldstyle=FALSE, ...) + breaks, oldstyle=FALSE, + useRaster=FALSE, ...) { if (missing(z)) { if (!missing(x)) { @@ -97,5 +98,12 @@ if (length(y) <= 1) y <- par("usr")[3:4] if (length(x) != nrow(z)+1 || length(y) != ncol(z)+1) stop("dimensions of z are not length(x)(-1) times length(y)(-1)") - .Internal(image(as.double(x), as.double(y), as.integer(zi), col)) + if (useRaster) { + zc <- col[zi+1] + dim(zc) <- dim(z) + rasterImage(as.raster(zc), + xlim[1],ylim[1],xlim[2],ylim[2],interpolate=FALSE) + } else { + .Internal(image(as.double(x), as.double(y), as.integer(zi), col)) + } }