data(elec88)
par(mfrow = c(2, 2))
area.plot(elec88$area, cpoint = 1)
area.plot(elec88$area, lab = elec88$lab$dep, clab = 0.75)
area.plot(elec88$area, clab = 0.75)
# elec88$neig <- neig(area = elec88$area)
area.plot(elec88$area, graph = elec88$neig, sub = "Neighbourhood graph", possub = "topright")
par(mfrow = c(1, 1))
if (FALSE) {
par(mfrow = c(3, 3))
for(i in 1:9) {
x <- elec88$tab[,i]
area.plot(elec88$area, val = x, sub = names(elec88$tab)[i], csub = 3, cleg = 1.5)
}
par(mfrow = c(1, 1))
if(adegraphicsLoaded()) {
if(requireNamespace("sp", quietly = TRUE)) {
s.value(elec88$xy, elec88$tab, Sp = elec88$Spatial,
method = "color", psub.text = names(elec88$tab), psub.cex = 3,
pSp.col = "white", pgrid.draw = FALSE, porigin.include = FALSE)
}
} else {
par(mfrow = c(3, 3))
for(i in 1:9) {
x <- elec88$tab[, i]
s.value(elec88$xy, elec88$tab[, i], contour = elec88$contour,
meth = "greylevel", sub = names(elec88$tab)[i], csub = 3,
cleg = 1.5, incl = FALSE)
}
par(mfrow = c(1, 1))
}
if(!adegraphicsLoaded()) {
data(irishdata)
par(mfrow = c(2, 2))
w <- ade4:::area.util.contour(irishdata$area)
xy <- ade4:::area.util.xy(irishdata$area)
area.plot(irishdata$area, cpoint = 1)
apply(w, 1, function(x) segments(x[1], x[2], x[3], x[4], lwd = 3))
area.plot(irishdata$area, clabel = 1)
s.label(xy, area = irishdata$area, incl = FALSE, clab = 0,
cpoi = 3, addax = FALSE, contour = w)
s.label(xy, area = irishdata$area, incl = FALSE,
addax = FALSE, contour = w)
par(mfrow = c(1, 1))
}
}
data(irishdata)
w <- irishdata$area[c(42:53, 18:25), ]
w
w$poly <- as.factor(as.character(w$poly))
area.plot(w, clab = 2)
points(68, 59, pch = 20, col = "red", cex = 3)
points(68, 35, pch = 20, col = "red", cex = 3)
points(45, 12, pch = 20, col = "red", cex = 3)
sqrt((59 - 35) ^ 2) + sqrt((68 - 45) ^ 2 + (35 - 12) ^ 2)
area2link(w)
Run the code above in your browser using DataLab