Martin Ivanov
2012-Jul-20 13:40 UTC
[R] overlay contourplot with labels over spplot with color regions?
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
Roger Bivand
2012-Jul-21 14:52 UTC
[R] overlay contourplot with labels over spplot with color regions?
Martin Ivanov <tramni <at> abv.bg> writes:> > Dear R users, > > I have the following problem. I plot a SpatialPixelsDataFrame object withspplot and I need to add a contourplot> of another spatial variable.... You may find that posting to R-sig-geo will help. It would also help to include a self-contained example, say using the built-in meuse.grid data set. Roger> > I am already out of ideas. I am looking forward to Your replies. Anysuggestions will be appreciated.> > Best regards, > > Martin > >