# uses the idealised landscapes in 'segdata'
data(segdata)
grd <- GridTopology(cellcentre.offset=c(0.5,0.5),
cellsize=c(1,1), cells.dim=c(10,10))
grd.sp <- as.SpatialPolygons.GridTopology(grd)
d <- numeric() # index of dissimilarity
p <- numeric() # index of spatial proximity
for (i in 1:8) {
idx <- 2 * i
d <- append(d, seg(segdata[,(idx-1):idx]))
p <- append(p, whiteseg(grd.sp, data = segdata[,(idx-1):idx]))
full <- segdata[,(idx-1)] == 100
half <- segdata[,(idx-1)] == 50
plot(grd.sp)
plot(grd.sp[full,], col = "Black", add = TRUE)
if (any(half))
plot(grd.sp[half,], col = "Grey", add = TRUE)
text(5, 11.5, labels =
paste("D = ", round(d[i], 2), ", P = ", round(p[i], 2), sep = ""))
}Run the code above in your browser using DataLab