Displaying 3 results from an estimated 3 matches for "samplerandom".
2018 Mar 08
0
add single points to a level plot
Hi all,
I ran the code:
> s <- stack(replicate(2, raster(matrix(runif(100), 10))))
> xy <- data.frame(coordinates(sampleRandom(s, 10, sp=TRUE)),
+ z1=runif(10), z2=runif(10))
> levelplot(s, margin=FALSE, at=seq(0, 1, 0.05)) +
+ layer(sp.points(xy, pch=ifelse(pts$z1 < 0.5, 2, 3), cex=2, col=1),
columns=1) +
+ layer(sp.points(xy, pch=ifelse(pts$z2 < 0.5, 2, 3), cex=2, col=1),
columns=2)
And got...
2018 Mar 08
3
add single points to a level plot
Hi all,
I'm trying to add single points with known coordinates to a level plot, but
could not find the proper answer. I got to know that layer() function is
good for this, but I don't know which package is related to this function.
The source is here:
https://stackoverflow.com/questions/28597149/add-xy-points-to-raster-map-generated-by-levelplot
but my question is a little different as I
2018 Mar 08
1
add single points to a level plot
...the package 'rasterVis'
> library(rasterVis)
HTH,
Eric
On Thu, Mar 8, 2018 at 5:11 PM, lily li <chocold12 at gmail.com> wrote:
> Hi all,
>
> I ran the code:
> > s <- stack(replicate(2, raster(matrix(runif(100), 10))))
> > xy <- data.frame(coordinates(sampleRandom(s, 10, sp=TRUE)),
> + z1=runif(10), z2=runif(10))
> > levelplot(s, margin=FALSE, at=seq(0, 1, 0.05)) +
> + layer(sp.points(xy, pch=ifelse(pts$z1 < 0.5, 2, 3), cex=2, col=1),
> columns=1) +
> + layer(sp.points(xy, pch=ifelse(pts$z2 < 0.5, 2, 3), cex=2, co...