if (requireNamespace("ggplot2", quietly = TRUE)) {
library(ggplot2)
}
if (requireNamespace("maps", quietly = TRUE)) {
library(maps)
}
if (requireNamespace("mapproj", quietly = TRUE)) {
library(mapproj)
}
data(earthquakes)
world <- map_data("world")
g.earthquakes <- ggplot() +
geom_map(data = world, map = world,
mapping = aes(map_id = region),
color = "grey90", fill = "grey80") +
geom_point(data = earthquakes,
mapping = aes(x = Longitude, y = Latitude),
color = "red",alpha=.2,size=.75,stroke=0) +
scale_y_continuous(breaks = NULL, limits = c(-90, 90)) +
scale_x_continuous(breaks = NULL, limits = c(-180, 180)) +
coord_map("mercator")
g.earthquakes
Run the code above in your browser using DataLab