Skip to content

using spplot to superimpose points and polygons on SpatialGridDataFrame

2 messages · Parviez Hosseini, Edzer Pebesma

#
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






--
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.
#
On 03/12/2014 06:03 PM, Parviez Hosseini wrote:
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?