Analysis of Japanese Earthquakes Data

[This article was first published on Issei's Smart Analysis, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Latest version is here.

Greater attention is much more about earthquakes, Touhoku earthquake has occurred on March 11, 2011. Earthquake data are released at Japan Weather Association’s We can get these variables from the site.

  • Date, Time
  • Area
  • Lat/Lon
  • Depth
  • Magnitude

The information is currently available from August 23, 2008. There ware 7,392 earthquakes in three years until August 5, 2011. Almost all earthquakes happened in Japan. I summarize frequencies of earthquakes at each year.

Year Freq
August 23, 2008- 639
2009 1,400
2010 1,265
-August 5, 2011 4,088

Even if annual frequency is about 1,200~1,400 but at this year already more than 4,000 earthquakes have happened.

Next, I show longitudinal frequencies of earthquakes by magnitude.

Touhoku Area (including Fukushima)

X-axis is day, Y-axis is frequency of earthquake and color shows magnitude. The color becomes more brown, the earthquake is small. “1-11” of x-axis shows January 11.

You can see and follow the features as follows.

  • ~March 8: not much earthquakes
  • March 9, 10: Observed large earthquakes (one M7, five M6s)
  • March 11: Touhoku earthquake
  • March 12~: The number of earthquakes gradually vanishing
  • April 11~: Occurred M7 earthquake
  • end of April to head of June: Occurred about average 20 earthquakes
  • June~head of August: Occurred about average 10~20 earthquakes

Earthquakes have seemed to calm after an Touhoku earthquake happened, many earthquakes have been observed again after April 11. Number of earthquakes seems a little less since June but they does not seem to go back as usual yet.

Kahto Area (including Tokyo)

This shows a similar trend with the results of Tohoku. Occurred about average 5~10 earthquakes since June.


Frequencies of earthquakes increased in Kanto, Tohoku, Chubu (including Nagoya) area.

Many earthquakes seem to occurred yet.

An example code of R is below.

eq      <- read.csv("",
eqFreq1 <- table(eq$date2, trunc(eq$M), eq$area2)
eqFreq2 <- melt(eqFreq1)
names(eqFreq2) <- c("date", "M", "area", "freq")
eqFreq2$date   <- as.POSIXct(eqFreq2$date, format="%Y-%m-%d")
eqFreq2$M      <- factor(eqFreq2$M)
ggplot(eqFreq2[eqFreq2$area=="Touhoku",], aes(date, weight=freq, fill=M)) + 
 geom_bar(binwidth=60*60*24) + opts(title="Touhoku Area") + 
 scale_fill_brewer(type="div") + xlab("Date") + ylab("Frequency")

To leave a comment for the author, please follow the link and comment on their blog: Issei's Smart Analysis. offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)