[R] add single points to a level plot
jdnewmil at dcn.davis.ca.us
Thu Mar 8 16:53:22 CET 2018
findFn( "layer" )
findFn( "levelplot" )
Also, experts in spatial analysis tend to answer questions on the special mailing list where the Posting Guide says they should. Read it to find out where that is.
Sent from my phone. Please excuse my brevity.
On March 8, 2018 7:11:34 AM PST, lily li <chocold12 at gmail.com> wrote:
>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),
>+ layer(sp.points(xy, pch=ifelse(pts$z2 < 0.5, 2, 3), cex=2, col=1),
>And got the error:
>Error in UseMethod("levelplot") :
> no applicable method for 'levelplot' applied to an object of class
>"c('RasterStack', 'Raster', 'RasterStackBrick', 'BasicRaster')"
>what is the problem? Thanks.
>On Thu, Mar 8, 2018 at 12:07 AM, lily li <chocold12 at gmail.com> wrote:
>> Hi all,
>> I'm trying to add single points with known coordinates to a level
>> but could not find the proper answer. I got to know that layer()
>> is good for this, but I don't know which package is related to this
>> function. The source is here:
>> but my question is a little different as I know the coordinates of
>> single point, rather than a range. Thanks for any help you could
> [[alternative HTML version deleted]]
>R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
>PLEASE do read the posting guide
>and provide commented, minimal, self-contained, reproducible code.
More information about the R-help