Simulate minefields with two samples in the same plot in R -
i trying simulate minefield plotting 2 poisson distributed samples in same plot, 1 higher intensity , smaller area other. minefield , other noise (stones, holes, metal) seen points. cannot r plot points same units in axis. whatever do, points span entire plot, though want x points cover quarter of plot. r-code following:
library(spatstat) y = rpoispp(c(5),win=owin(c(0,10),c(0,10))) x = rpoispp(c(10),win=owin(c(0,5),c(0,5)))
please let me know if can me.
my guess doing like:
> plot(y) > plot(x)
to plot points.
the problem default behavior of plot function class ppp
(which rpoispp
function returns) create new plot points. second plot
call erases first plot, , plots own points in differently scaled window. can override behavior setting option add=true
second plot. code
> plot(y) > plot(x, add=true, cols="red")
should like:
check out docs (help(plot.ppp)
) more explanation , other options prettify plot.
Comments
Post a Comment