library(wpp2015) library(plotrix) data(e0M);data(e0F) par(mfrow=c(1,2)) plot(t(subset(e0F,country=="Japan")[,3:15]),type="o",pch=15,col="red",ylim=c(60,97),xaxt="n",las=1,xlab="",ylab="") lines(t(subset(e0M,country=="Japan")[,3:15]),type="o",pch=16,col ="black") axis(1, labels=FALSE, at=1:13) staxlab(1,1:13,colnames(e0M[3:15]),srt=45) legend("topleft", legend = c("Male","Female"), col =c("black","red"), pch =c(16,15), lty =1) title("日本人の平均寿命") data(e0Mproj);data(e0Fproj) subset(e0Mproj, e0Mproj[, 1] == "Japan") subset(e0Fproj, e0Mproj[, 1] == "Japan") plot(t(subset(e0Fproj,country=="Japan")[,3:19]),type="o",pch=15,col="red",ylim=c(60,97),xaxt="n",las=1,xlab="",ylab="",lty=3) lines(t(subset(e0Mproj,country=="Japan")[,3:19]),type="o",pch=16,col ="black",lty=3) axis(1, labels=FALSE, at=1:17) staxlab(1,1:17,colnames(e0Mproj[3:19]),srt=45) legend("topleft", legend = c("Male","Female"), col =c("black","red"), pch =c(16,15), lty =3) title("日本人の予想平均寿命") par(mfrow=c(1,1))
|