packrat/lib-R/graphics/demo/image.R

#  Copyright (C) 1997-2009 The R Core Team

require(datasets)
require(grDevices); require(graphics)

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)
UBC-MDS/Karl documentation built on May 22, 2019, 1:53 p.m.