Skip to content
Prev 4842 / 29559 Next

contour lines on a plot

Hi,
El lun, 19-01-2009 a las 22:19 +0100, Jos? Manuel Blanco Moreno
escribi?:
Very well spotted!!

The right code should be as follows (the change is in the definition of
'spvolcano'):

library(maptools)

x <- 10*1:nrow(volcano)
y <- 10*1:ncol(volcano)
clv<-contourLines(x, y, volcano)

res <- ContourLines2SLDF(clv)

grd<-GridTopology(c(0,0), c(10, 10), dim(volcano))
spvolcano<-SpatialGridDataFrame(grd, 
   data.frame(altitude=as.vector((volcano[,ncol(volcano):1]))))

spplot(spvolcano, sp.layout=list(list("sp.lines", res)) )



Best,

Virgilio