[R-sig-Geo] using spplot to superimpose points and polygons on SpatialGridDataFrame

Edzer Pebesma edzer.pebesma at uni-muenster.de
Wed Mar 12 23:19:34 CET 2014



On 03/12/2014 06:03 PM, Parviez Hosseini wrote:
> I realize this is an old post, but this thread is still one of the top google
> finds when trying to research the issue. 
> 
> I was able to reproduce the problem simply by replacing:
> 
> gridded(meuse.grid) <- TRUE ## original line
> 
> with 
> 
> gridded(meuse.grid) <- FALSE ## original line
> 
> Thus:
> library(sp)
> data(meuse)
> data(meuse.grid)
> coordinates(meuse) <- c("x", "y")
> coordinates(meuse.grid) <- c("x", "y")
> gridded(meuse.grid) <- FLASE  ## TRUE successfully overlays points.
> pts <- list("sp.points", meuse, pch = 4, col = "black", cex=0.5)
> greys <- grey(0:256 / 256)
> spplot(meuse.grid, "dist", col.regions=greys, sp.layout=list(pts),
>    cuts=length(greys)-1, colorkey=TRUE) 
> 
> runs quietly, but there no points produced by sp.layout=list(pts), they are
> under the meuse.grid points

There are points produced by sp.layout=list(pts), but they are indeed
hidden by the big filled circles -- try:

spplot(meuse.grid["dist"], col.regions=greys, sp.layout=pts,
cuts=length(greys)-1, colorkey=TRUE, cex=.1)

according to the documentation, with

pts <- list("sp.points", meuse, pch = 16, col = "green", cex=2,first=FALSE)

it should plot on top, but doesn't.

The original thread, which you didn't quote, was from 2007. Is this a
problem for you?

> 
> 
> 
> 
> 
> 
> --
> View this message in context: http://r-sig-geo.2731867.n2.nabble.com/using-spplot-to-superimpose-points-and-polygons-on-SpatialGridDataFrame-tp2763881p7585938.html
> Sent from the R-sig-geo mailing list archive at Nabble.com.
> 
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
> 

-- 
Edzer Pebesma
Institute for Geoinformatics (ifgi), University of Münster
Heisenbergstraße 2, 48149 Münster, Germany. Phone: +49 251
83 33081 http://ifgi.uni-muenster.de GPG key ID 0xAC227795

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 490 bytes
Desc: OpenPGP digital signature
URL: <https://stat.ethz.ch/pipermail/r-sig-geo/attachments/20140312/0894946b/attachment.bin>


More information about the R-sig-Geo mailing list