## Use the grid created in the att.plot example
example(att.plot)
## Create a regular matrix grid
lattice.grid <- expand.grid(x=seq(min(grid$nodes$x), max(grid$nodes$x),
len=10), y=seq(min(grid$nodes$y),
max(grid$nodes$y), len=10))
elems <- find.elem(lattice.grid$x, lattice.grid$y, grid, units='m')
elems
## Plot the result, but only points in the grid
elems[elems == -1] <- NA
plot(lattice.grid$x, lattice.grid$y, pch=15,
col=heat.colors(max(elems, na.rm=TRUE) + 2)[elems+2])Run the code above in your browser using DataLab