[R-sig-Geo] SPATSTAT: converting owin(mask) to owin (polygon)
Adrian.Baddeley at csiro.au
Adrian.Baddeley at csiro.au
Tue Jun 30 12:58:15 CEST 2009
Alexandre VILLERS wrote:
> I would like to create a new window for a point pattern in order to get
> a tess object (dirichlet tessellation) from that same point pattern.
> For the moment, here is an example of what I do:
> PPP<- rpoispp(100) #generate a point pattern
> wind1<-density(PPP, sigma=0.1) #smoothed object of class im
> wind2<-wind1 #copy the object
> wind2$v<-ifelse(wind2$v<150, NA, wind1$v) #replace with NAs the value
> # of pixel I don't want to keep (those whose intensity is < 150)
> M<-as.owin(wind2) #convert the im object to a window
> PPPd<-ppp(PPP$x,PPP$y, window=M) #the new point pattern with the new window
> plot(dirichlet(PPPd)) #the result which did not convince me !
This is a bug in plot.tess. The dirichlet command has correctly computed a tessellation, but the plot method for tessellations has included some strange black lines. To suppress the lines, use
plot(dirichlet(PPPd), axes=FALSE)
However it will take some more work to get a nice appearance for this plot. I will repair plot.tess in the next version (1.16-0) which will be out soon.
Incidentally, the following lines ...
> wind2 <- wind1
> wind2$v<-ifelse(wind2$v<150, NA, wind1$v)
> M<-as.owin(wind2) #convert the im object to a window
... could be replaced by
M <- levelset(wind1, 150, "<")
Adrian Baddeley
More information about the R-sig-Geo
mailing list