load("2015.RData") eq2015<-subset(eqdata,longitude>=132.5 & longitude<=135 & latitude>=34.5 & latitude<=35.9 & mag>=-4) load("tottori1998_2014.RData") eqdata<-rbind(eqdata[,-6],eq2015) library(ggmap) library(mapproj) eqdata1<-subset(eqdata,mag<1) eqdata1$Magnitude<-"1 未満" eqdata2<-subset(eqdata,mag>=1 & mag<3) eqdata2$Magnitude<-"1以上3未満" eqdata3<-subset(eqdata,mag>=3) eqdata3$Magnitude<-"3 以上" head(eqdata1) ; tail(eqdata1) head(eqdata2) ; tail(eqdata2) head(eqdata3) ; tail(eqdata3) eq<-rbind(eqdata1,eqdata2,eqdata3) eqdata4<-subset(eqdata,mag>=4 ) sortlist <- order(eqdata4$mag) eqdata4<- eqdata4[sortlist,] lon1<-c(133,134.65) lat1<-c(35.1,35.65) center <- geocode('kurayoshi') tottori <- get_map(c(center$lon, center$lat), zoom = 9, maptype = 'terrain') alpha=0.8 ; size=1 ggmap(tottori) + geom_point(data=eq, aes(x=longitude, y=latitude,color=Magnitude),alpha=alpha,size=size)+ geom_point(data=eqdata4, aes(x=longitude, y=latitude,size=mag),alpha=1,shape=21,color="gray",fill="black")+ geom_point(aes(x=134.1844,y=35.4775),shape="X",color="black",size=10)+ scale_colour_manual(values=c("red","green","blue"), breaks = c("1 未満","1以上3未満","3 以上"))+ scale_size(range = c(6,10))+ labs(colour="マグニチュード",size="マグニチュード 4以上")+ guides(size = guide_legend(order = 2), colour = guide_legend(order = 1)) + ggtitle("震源分布 1998_2015 (X印:1943年鳥取地震)") library(spatstat) library(xts) eq.xts<-xts(eqdata[,2:5], strptime(eqdata$time, "%Y-%m-%d %H:%M:%S")) date<-"2000" subeqdata<-data.frame(time=index(eq.xts[date]),coredata(eq.xts[date])) subeq<-subset(subeqdata,lon1[1]<=longitude & longitude<=lon1[2] & lat1[1]<=latitude & latitude<=lat1[2]) px<-subeq$longitude py<-subeq$latitude pnt <- ppp(px, py, c(lon1[1],lon1[2]), c(lat1[1],lat1[2])) Q <- quadratcount(pnt, nx = 33, ny = 11) plot(density(pnt),col=topo.colors(100),axes=T,main=paste0("density(",date,")")) contour(density(pnt),lwd=0.5,add=T) plot(pnt,pch=20,cex=0.3,col="gray50",add=T) tc <- colourmap(topo.colors(100), breaks=seq(0,30000,length=101)) plot(density(pnt),col=tc,axes=T,main=paste0("density(",date,") 色付け範囲固定")) contour(density(pnt),lwd=0.5,add=T) plot(pnt,pch=20,cex=0.3,col="gray50",add=T) contour(density(pnt),axes=T,col=rgb(0,0,1,alpha=0.5),xlab="lon",ylab="lat",main=paste0("地震の発生数(",date,")")) plot(pnt,cols=rgb(0,0,0,alpha=0.1),cex=0.2,add=T) plot(Q, add = TRUE, cex =0.5,col="red")
|