eqdata <- dbGetQuery(con, "SELECT * FROM japan1998_2014 WHERE time LIKE '2008-06-%';") subset(eqdata,mag==max(eqdata$mag)) eqdata.xts<-as.xts(read.zoo(eqdata[,-6])) period<-"2008-06-14::2008-06-20" eqdata<-data.frame(eqdata.xts[period]) eqdata1<-subset(eqdata,depth<10) eqdata1$depth_rank<-" 10km 未満" eqdata1$col<-"red" eqdata2<-subset(eqdata,depth>=10 & depth<20) eqdata2$depth_rank<-" 10km以上20km未満" eqdata2$col<-"orange" eqdata3<-subset(eqdata,depth>=20 & depth<40) eqdata3$depth_rank<-" 20km以上40km未満" eqdata3$col<-"gold4" eqdata4<-subset(eqdata,depth>=40 & depth<80) eqdata4$depth_rank<-" 40km以上80km未満" eqdata4$col<-"green" eqdata5<-subset(eqdata,depth>=80 & depth<150) eqdata5$depth_rank<-" 80km以上150km未満" eqdata5$col<-"blue" eqdata6<-subset(eqdata,depth>=150) eqdata6$depth_rank<-"150km以上" eqdata6$col<-"purple" eq<-rbind(eqdata1,eqdata2,eqdata3,eqdata4,eqdata5,eqdata6) sortlist <- order(eq$mag) eq<- eq[sortlist,] subeq<-subset(eq,mag>=1) mag1und<-subset(eq,mag<1) par(family = "TakaoExMincho") map('japan',xlim=c(139.8807,141.8807),ylim=c(38.02983,40.02983),fill=T,col="gray85",mar = c(5,4,4,15)) map('japan',col="gray10",boundary =T,add=T) points(mag1und$longitude,mag1und$latitude,cex=0.2,bg=adjustcolor(subeq$col,0.7),pch=21,col="black") points(subeq$longitude,subeq$latitude,cex=(subeq$mag-0.2)/2,bg=adjustcolor(subeq$col,0.7),pch=21,col="black") par(xpd=T) cexsize=(c(1,3,5,7)-0.2)/2 legend(par("usr")[2]*1.001,par("usr")[3]*0.05+par("usr")[4]*0.95,title="Magnitude", legend = c("M<1","M=1","M=3","M=5","M=7"), col=1,pch=21,pt.cex=c(0.2,cexsize), cex =1,bg ="gray90", x.intersp = 2, y.intersp =1.8,bty = "n") legend(par("usr")[2],par("usr")[3]*0.6+par("usr")[4]*0.4,title="Depth", legend = c("D<10km","10km<=D<20km","20km<=D<40km","40km<=D<80km","80km<=D<150km","150km<=D"), cex=1,pch=19,col=c("red","orange","gold4","green","blue","purple"), pt.cex =1.5,bg ="gray90", x.intersp = 1, y.intersp =1.2,bty = "n") par(xpd=F) title(paste0(period," 岩手・宮城内陸地震")) title("","( 地震データ:気象庁地震カタログ )",line=2.5) map.axes(cex.axis=0.8,las=1)
|