File talk:Yellowstone earthquakes history.svg

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia

Code to regenerate and update figure[edit]

This figure can be generated by remotely loading this CSV file. Below is the full R code to produce the figure:

library("dplyr")
library("ggplot2")

ys <- read.csv("http://www.quake.utah.edu/EQCENTER/LISTINGS/Catalogs/Yell_UUUS_c.csv")

svg("~/other/graphapedia/figs/yellowstone_earthquakes.svg", 6, 4)
ys %>% group_by(year) %>% filter(year > 1972) %>%  tally() %>%
  ggplot(data=., aes(x=year, y=n)) + 
  geom_bar(stat="identity") +
  labs(x="Year", y="Number of earthquakes") + 
  scale_y_continuous(expand=c(0,0), limits=c(0, 3500)) +
  scale_x_continuous(expand=c(0,0.2)) +
  theme_bw() +
  ggtitle("Earthquakes in Yellowstone National Park region (1973-2014)")
dev.off()