japan = map_data("japan") d=60000 for (i in 1:nrow(nujap)) { lon1<-destPointRhumb(c(nujap$longitude[i],nujap$latitude[i]), 270, d, r = 6378137)[1] lon2<-destPointRhumb(c(nujap$longitude[i],nujap$latitude[i]), 90, d, r = 6378137)[1] Lon.range = c(lon1,lon2) lon1<-destPointRhumb(c(nujap$longitude[i],nujap$latitude[i]), 180, d, r = 6378137)[2] lon2<-destPointRhumb(c(nujap$longitude[i],nujap$latitude[i]), 0, d, r = 6378137)[2] Lat.range = c(lon1,lon2) p0<-ggplot() + borders("japan",fill="gray75", size = 0.3) + theme_bw() + coord_map(xlim=Lon.range ,ylim=Lat.range) + labs(y="",x="") eq1=eq1963[ eq1963$mag>=5,] p0<-p0 + geom_point(data=eq1, aes(x=longitude, y=latitude,fill=depth_rank,size=mag),alpha=0.8,shape=21,color="gray20")+ scale_fill_manual(values=c("red","orange","gold4","green","blue","purple"), breaks = c(" 10km 未満"," 10km以上20km未満"," 20km以上40km未満"," 40km以上80km未満"," 80km以上150km未満","150km以上"))+ scale_size(breaks=c(5,6,7,8,9),range = c(3,10)) + labs(size="Magnitude",fill="Depth",title="震源分布(マグニチュード5以上)1923 ~ 1963-10-26[データ:気象庁]") + guides(size = guide_legend(order = 1), fill = guide_legend(order = 2)) + theme(text=element_text(size=12, family="TakaoExMincho")) p0<- p0 + geom_point(data=nujap,aes(x=longitude, y=latitude),shape=24,size =5, fill=rgb(0,0,0,0.8),color="black") p0<- p0 + geom_text(data=nujap[i,],aes(x=longitude, y=latitude, label = station),vjust = 0, nudge_y = 0.02) circle30=as.data.frame(destPoint(c(nujap$longitude[i],nujap$latitude[i]), b=1:365, d=30000)) p0<-p0 + geom_polygon(data=circle30, aes(x=lon,y=lat), color="black",fill="red",alpha=0.2) p0<-p0 + geom_text(aes(x=nujap$longitude[i],y=max(circle30$lat)),label="30km", nudge_y = 0.02) circle50=as.data.frame(destPoint(c(nujap$longitude[i],nujap$latitude[i]), b=1:365, d=50000)) p0<-p0 + geom_polygon(data=circle50, aes(x=lon,y=lat), color="black",fill="blue",alpha=0.2) p0<-p0 + geom_text(aes(x=nujap$longitude[i],y=max(circle50$lat)),label="50km", nudge_y = 0.02) p<-ggplot() + borders("japan",fill="gray75", size = 0.3) + theme_bw() + coord_map(xlim=Lon.range ,ylim=Lat.range) + labs(y="",x="") eq1=eq[ eq$mag>=5,] p<-p + geom_point(data=eq1, aes(x=longitude, y=latitude,fill=depth_rank,size=mag),alpha=0.8,shape=21,color="gray20")+ scale_fill_manual(values=c("red","orange","gold4","green","blue","purple"), breaks = c(" 10km 未満"," 10km以上20km未満"," 20km以上40km未満"," 40km以上80km未満"," 80km以上150km未満","150km以上"))+ scale_size(breaks=c(5,6,7,8,9),range = c(3,10)) + labs(size="Magnitude",fill="Depth",title="震源分布(マグニチュード5以上)1923 ~ 2016-11-21[データ:気象庁]") + guides(size = guide_legend(order = 1), fill = guide_legend(order = 2)) + theme(text=element_text(size=12, family="TakaoExMincho")) p<- p + geom_point(data=nujap,aes(x=longitude, y=latitude),shape=24,size =5, fill=rgb(0,0,0,0.8),color="black") p<- p + geom_text(data=nujap[i,],aes(x=longitude, y=latitude, label = station),vjust = 0, nudge_y = 0.02) circle30=as.data.frame(destPoint(c(nujap$longitude[i],nujap$latitude[i]), b=1:365, d=30000)) p<-p + geom_polygon(data=circle30, aes(x=lon,y=lat), color="black",fill="red",alpha=0.2) p<-p + geom_text(aes(x=nujap$longitude[i],y=max(circle30$lat)),label="30km", nudge_y = 0.02) circle50=as.data.frame(destPoint(c(nujap$longitude[i],nujap$latitude[i]), b=1:365, d=50000)) p<-p + geom_polygon(data=circle50, aes(x=lon,y=lat), color="black",fill="blue",alpha=0.2) p<-p + geom_text(aes(x=nujap$longitude[i],y=max(circle50$lat)),label="50km", nudge_y = 0.02) png(paste0("nuclear",i,".png"),width=1600,height=600) grid.arrange(p0,p,ncol = 2) dev.off() }
|