require(fmsb)
x <- Prefe0
males <- t(x[, 3:14])
colnames(males) <- x$PNAME
females <- t(x[, 15:26])
colnames(females) <- x$PNAME
COL <- ifelse(x$PNAME=="Nagano", "blue", ifelse(x$PNAME=="Okinawa", "red", "lightgrey"))
LWD <- ifelse(x$PNAME=="Nagano", 2, ifelse(x$PNAME=="Okinawa", 2, 1))
LTY <- ifelse(x$PNAME=="Nagano", 1, ifelse(x$PNAME=="Okinawa", 1, 3))
years <- 1965+0:11*5
layout(t(1:2))
matplot(years, males, type="l", col=COL, lwd=LWD, lty=LTY,
main="Changes of e0 for males in each prefecture of Japan
(Blue: Nagano, Red: Okinawa, Grey: Other)")
matplot(years, females, type="l", col=COL, lwd=LWD, lty=LTY,
main="Changes of e0 for females in each prefecture of Japan
(Blue: Nagano, Red: Okinawa, Grey: Other)")
Run the code above in your browser using DataLab