[R-sig-Geo] drawing order in spplot
Edzer J. Pebesma
e.pebesma at geo.uu.nl
Sun Jul 9 23:29:37 CEST 2006
Duncan Golicher wrote:
>Many thanks to everyone involved in putting together the excelent sp
>package. I have just used for teaching a brief intro to applied geostats
>with gstat. Students found life much easier than a year ago when I had
>to try to explain a less structured approach to the data.
>A simple question arose after the class. According to the spplot
>documentation "for grids and polygons sp.layout is drawn afterwards (so
>the item will not be overdrawn by the grid and/or polygon)".
>So in this example we expected a DEM to be drawn first, then municipal
>boundaries.
>
> > class(municipios)
>[1] "SpatialPolygonsDataFrame"
> > class(chisgrid)
>[1] "SpatialPixelsDataFrame"
>
>municips <- list("sp.polygons", municipios)
>spplot(chisgrid["dem"],sp.layout=municips)
>
>The municipal boundaries are drawn first then overdrawn by the DEM,
>which was not what we expected or wanted. I couldn't find how to avoid
>this, apart from the simple solution of ..
>
>image(chisgrid,col=terrain.colors(20))
>plot(municipios,add=T)
>
>instead of spplot.The figures on http://r-spatial.sourceforge.net all
>appear to have the grid drawn first. Is there a way to reverse this?
>
>Duncan
>
>
>
the sp.layout argument accepts a list item, first=TRUE or first=FALSE,
telling whether to
first or to last plot this item; you could try to use that.
I'll review whether the current setup is logical, or not.
--
Edzer
More information about the R-sig-Geo
mailing list