[R-sig-Geo] contour lines on a plot
Virgilio Gomez Rubio
Virgilio.Gomez at uclm.es
Mon Jan 19 23:43:11 CET 2009
Hi,
El lun, 19-01-2009 a las 22:19 +0100, José Manuel Blanco Moreno
escribió:
> Just a doubt... there seems that the contours are not shifted but
> "mirrored" (flipped) along an horizontal line?
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
More information about the R-sig-Geo
mailing list