Japan Quake Map
with R, ggplot2, and FFmpeg
As a follow-up to ‘Analysis of Japanese Earthquakes Data’,
I sought to produce a map including infomation about epicenter and magnitude.
Last article have contributed to visualize the frequency of earthquakes,
on the other hand I have attempted to visualize infomation
about epicenter and magnitude on a map with R, ggplot2, and FFmpeg.
The term of analysis data is from September 24, 2007 through October 26, 2011,
including “The 2011 off the Pacific coast of Tohoku Earthquake” on March 11, 2011.
The number of sample is 8692.
Data source is website of Japan Weather Association.
The result can be seen at YouTube.
Please pay attention before and after “Tohoku Earthquake” on March 11, 2011 (1:03).
I recommend the “setting of 1080p” and “full screen” view.
There was an omen of a severe earthquake two days before that.
But unhappily, we couldn’t make the best use of the bad omen.
After “Tohoku Earthquake”, many earthquakes have occured until today (October 2011).
More than 15,000 people confirmed died, more than 4000 people is still missing,
and there’re a lot of people who are victims.
Finally, I’d like to express our thanks to all of you for helping us.
Sample code of R is as follows:
# setting parameter about a map.
long <- c (120, 150)
lat <- c (25, 50)
# Reading data of earthquakes and map.
url <- "http://knowledgediscovery.jp/data/eq39.csv"
eq <- read.csv(url, as.is=T)
map <- data.frame(map(xlim = long, ylim = lat))
# creating image with ggplot.
p <- ggplot(eq, aes(long, lat))
p + geom_path(aes (x, y), map) +
geom_point(aes(size = Magnitude, colour = Magnitude), alpha = 1/2) +