if(dev.cur() <= 1) get(getOption("device"))() opar <- par(ask = interactive() && (.Device %in% c("X11", "GTK", "windows","quartz"))) # For source x <- 10*(1:nrow(volcano)); x.at <- seq(100, 800, by=100) y <- 10*(1:ncol(volcano)); y.at <- seq(100, 600, by=100) # Using Terrain Colors image(x, y, volcano, col=terrain.colors(100),axes=FALSE) contour(x, y, volcano, levels=seq(90, 200, by=5), add=TRUE, col="brown") axis(1, at=x.at) axis(2, at=y.at) box() title(main="Maunga Whau Volcano", sub = "col=terrain.colors(100)", font.main=4) # Using Heat Colors image(x, y, volcano, col=heat.colors(100), axes=FALSE) contour(x, y, volcano, levels=seq(90, 200, by=5), add=TRUE, col="brown") axis(1, at=x.at) axis(2, at=y.at) box() title(main="Maunga Whau Volcano", sub = "col=heat.colors(100)", font.main=4) # Using Gray Scale image(x, y, volcano, col=gray(100:200/200), axes=FALSE) contour(x, y, volcano, levels=seq(90, 200, by=5), add=TRUE, col="black") axis(1, at=x.at) axis(2, at=y.at) box() title(main="Maunga Whau Volcano \n col=gray(100:200/200)", font.main=4) ## Filled Contours are even nicer sometimes : example(filled.contour) par(opar)