par(mfrow=c(1,2)) DD <- osakadata$賛成/(osakadata$投票者男+osakadata$投票者女) classes <- cut(DD,c(min(DD),0.5,max(DD)),include.lowest=T) cents <- coordinates(osaka) x <- cents[,1] y <- cents[,2] par(cex=0.9) cols <- c("pink","lightblue") plot(osaka,col=cols[classes],xlab="",ylab="",axes=F) box() text(x,y,as.character(osakadata$ATTR2),cex=0.7,pos=1,offset=0,col="black") legend("topleft",legend=c("賛成の多かった区","反対の多かった区"),cex=1,fill=c("lightblue","pink"),text.col='black') title("都構想に賛成の多かった区,反対の多かった区") DD <- osakadata$賛成/(osakadata$投票者男+osakadata$投票者女) cutnum<-20 classes <- cut(DD,seq(0.4,0.6,length=cutnum+1),include.lowest=T) cents <- coordinates(osaka) x <- cents[,1] y <- cents[,2] par(cex=0.9) colblue <- colorRampPalette(c("blue","#C6C6FF")) colred <- colorRampPalette(c("#FFC6C6","red")) cols<-rev(c(colblue(10),colred(10))) plot(osaka,col=cols[classes],xlab="",ylab="",axes=F) box() text(x,y,as.character(osakadata$ATTR2),cex=0.7,pos=1,offset=0,col="black") cols2 <- c(colblue(10),colred(10)) legend("topleft",legend=names(rev(table(classes))),cex=0.7,fill=cols2,text.col='black',ncol=2) title("都構想に賛成の割合") par(mfrow=c(1,1))
|