[R] Adding a distance scale to a plot?

Jason Rupert jasonkrupert at yahoo.com
Mon Jan 4 18:12:21 CET 2010


Do you know what steps I need to take to add a scale to a plot? 

I'm pulling my example out of "An Introduction to R: Software for StatisticalModelling & Computing" (see the R code around Figure 76).


I would like to add a scale to the image produced by the following code.  I would like to the scale to list the distance and units: 

data(volcano)
x <- 10*(1:nrow(volcano))
y <- 10*(1:ncol(volcano))

image(x, y, volcano,col = terrain.colors(100),axes = FALSE)
contour(x, y, volcano, levels = seq(90, 200, by=5),add = TRUE, col = "peru")
axis(1, at = seq(100, 800, by = 100))
axis(2, at = seq(100, 600, by = 100))
box()
title(main = "Maunga Whau Volcano",font.main = 4)


Thanks for any feedback and insights.






More information about the R-help mailing list