library(openxlsx) df<-read.xlsx("http://kanggc.iptime.org/book/data/double.xlsx") df_dat<-data.matrix(df) year<-df_dat[,1] korea<-df_dat[,2] jeju<-df_dat[,3] par(mfrow=c(1,2)) par(mar = c(5, 4, 4, 4) + 0.3) # Leave space for z axis plot(year, korea,type="l",col="red") # first plot par(new = TRUE) plot(year, jeju, type = "l", axes = FALSE, col="black",bty = "n", xlab = "", ylab = "") axis(side=4, at = pretty(range(jeju))) mtext("jeju", side=4, line=3) year_1<-year[2:17] jeju.ts<-ts(jeju,start=2000,end=2016,frequency=1) ljeju<-lag(jeju.ts,k=-1) gjeju<-((jeju.ts-ljeju)/ljeju)*100 jeju_1<-jeju[2:17] par(mar = c(5, 4, 4, 4) + 0.3) # Leave space for z axis plot(year_1, jeju_1,type="h",col="red",ylim=c(0,1.8e+07)) # first plot par(new = TRUE) plot(year_1, gjeju, type = "l", axes = FALSE, col="black",bty = "n", xlab = "", ylab = "") axis(side=4, at = pretty(range(gjeju))) mtext("gjeju", side=4, line=3)