[R] overlay contourplot with labels over spplot with color regions?

Martin Ivanov tramni at abv.bg
Fri Jul 20 15:40:31 CEST 2012


 Dear R users,

I have the following problem. I plot a SpatialPixelsDataFrame object with spplot and I need to add a contourplot
of another spatial variable. To be more precise, I plot the  SpatialPixelsDataFrame of the mean precipitation over Germany with coloured regions and I want to overlay the isolines of the 500, 1000 and 1500 m height above sea level. Of course I can plot the lines as SpatialLines using the sp.layout argument to spplot, but so I lose the labels on the lines. And I want the height above sea level to be labelled just as it is labelled in a contour plot. Is it possible to achieve that with lattice? 

I am still new to lattice, so I beg Your excuse in case I am asking something trivial. I googled a lot and tried a lot of things, but none worked. I tried with contour, it does work with Spatial objects, but unfortunately contour does not seem work with lattice. And the lattice equivalent contourplot does not recognise Spatial objects. 

I am already out of ideas. I am looking forward to Your replies. Any suggestions will be appreciated.

Best regards,

Martin



More information about the R-help mailing list