{
# Create a regular matrix grid
nodes = get.nodes(ocean.demo.grid)
lattice.grid = expand.grid(x=seq(min(nodes$x), max(nodes$x), len=50),
y=seq(min(nodes$y), max(nodes$y), len=50))
elems = find.elem(ocean.demo.grid, lattice.grid, units="m")
# Plot the result
plot(lattice.grid$x, lattice.grid$y, pch=15,
col=jet.colors(max(elems, na.rm=TRUE) + 2)[elems+2])
}
Run the code above in your browser using DataLab