[R-sig-Geo] contour lines on a plot
Virgilio Gomez Rubio
Virgilio.Gomez at uclm.es
Mon Jan 19 19:05:25 CET 2009
Hi,
El lun, 19-01-2009 a las 18:37 +0100, Maxime Pauwels escribió:
> Dear Virgilio,
>
> I think you're right. Unfortunately, I am not familiar enough with the
> analysis of spatial data to avoid such conflict.
> Do you know wath function I should use to generate contour before
> conversion.
This example may help:
library(maptools)
res <- ContourLines2SLDF(contourLines(volcano))
grd<-GridTopology(c(0,0), 1/dim(volcano), dim(volcano))
spvolcano<-SpatialGridDataFrame(grd,
data.frame(altitude=as.vector(volcano)))
spplot(spvolcano, sp.layout=list(list("sp.lines", res)) )
There is something wrong in the way I have defined the grid topology and
the contour lines are shifted north, but you will get the idea. You
could also add labels to the contour lines.
Best,
Virgilio
More information about the R-sig-Geo
mailing list