Skip to content

Adding a distance scale to a plot?

3 messages · Jason Rupert, Walmes Zeviani, Jim Lemon

#
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.
#
JustADude wrote:
JustADude,

Take a look at help documentation of spplot() function on the sp package.
This function offer the scale mark on the plot.



-----
..oooO
..................................................................................................
..(....)... 0ooo...                              Walmes Zeviani
...\..(.....(.....)...     Master in Statistics and Agricultural
Experimentation
....\_)..... )../....       walmeszeviani at hotmail.com, Lavras - MG, Brasil
............
(_/............................................................................................
#
On 01/05/2010 04:12 AM, Jason Rupert wrote:
Hi Jason,
The lengthKey function in the plotrix package might be what you need.

Jim