Dear R users,

I am new to lattice but am trying to get to grips with it. 
I need to add contour lines for the topography to a plot I created with spplot. 
The topography is available as a
SpatialPixelsDataFrame object Z_sfc. If I plot it as spatial lines, after 
converting to a SpatialLines object:
imageZ <- as.image.SpatialGridDataFrame(x=Z_sfc);
cLZ <- contourLines(x=imageZ$x, y=imageZ$y, z=imageZ$z, levels = 
pretty(range(imageZ$z, na.rm=TRUE), 5));
sldfZ_sfc <- ContourLines2SLDF(cL=cLZ, proj4string=CRS(proj4string(Z_sfc)))
topography <- list("sp.lines", sldfZ_sfc, first=FALSE, col="black");

and then using the sp.layout=topgraphy argument to spplot, I lose the number 
labels on the lines. 
Is it possible in lattice to print the height of the isolines just as it is 
printed with contour?

I tried with contour, it does work with SpatialPixelsDataFrame, but 
unfortunately contour does not seem work with lattice. And the lattice 
equivalent contourplot does not recognise SpatialPixelsDataFrame objects. Is it 
possible somehow to add a contour plot of Z_sfc to my plot?


Many thanks in advance.

Martin

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to