x <- read.shape(system.file("shapes/sids.shp", package="maptools")[1])
plot(x)
n <- attr(x$Shapes,'nshps')
nParts <- integer(n)
for (i in 1:n) nParts[i] <- attr(x$Shapes[[i]], "nParts")
table(nParts)
cols <- c("azure", "blue", "orange")
fgs <- cols[nParts]
plot(x, fg=fgs)
res <- plot(x, auxvar=x$att.data$BIR74)
str(res)
Run the code above in your browser using DataLab