require(maps)
require(ggplot2)
require(ggthemes)
quake.data <- read.csv('https://earthquake.usgs.gov/earthquakes/feed/v1.0/summary/all_week.csv')
quake.data <- quake.data[quake.data[,15] == 'earthquake',] # earthquakes only, wtf are ice quakes anyway?
mapWorld <- borders("world", colour="gray50", fill="gray50") # create a layer of borders
ggplot() + mapWorld + geom_point(data = quake.data, aes(x=longitude, y=latitude, colour = mag, size=mag*10)) + ggtitle('Last week quakes visualised, size of the points is the magnitude', subtitle='Source: US Geological Survey') + theme_minimal() + theme(axis.title.x = element_blank(), axis.title.y = element_blank()) + scale_colour_gradient2(guide = guide_legend(title = "Magnitude"))
Instead of geom_point, I'd rather use geom_bar to create a bar representing the earthquake's magnitude. A solution seems to be to use geom_subplot[1], but that package is archived and the package's most recent fork doesn't build on R 3.4.2[2]. Any other vectors perhaps sort this? Many thanks in advance... -- H
--