Created
April 5, 2020 20:50
-
-
Save hathawayj/5193c042059f250127f914ab3447cc02 to your computer and use it in GitHub Desktop.
Plot of the exponential growth of temples by The Church of Jesus Christ of Latter-day Saints
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# install.packages(pacman) | |
pacman::p_load(tidyverse, rvest, lubridate, magick) | |
# Times that temples were opened | |
temple_time <- "https://churchofjesuschristtemples.org/statistics/milestones/" %>% | |
read_html() %>% | |
html_nodes("table") %>% | |
html_table() %>% .[[2]] %>% | |
rename_all(str_to_lower) %>% | |
mutate(announcement = dmy(announcement), groundbreaking = dmy(groundbreaking), | |
dedication = dmy(dedication)) | |
growth <- temple_time %>% | |
mutate(year_announce = year(announcement)) %>% | |
arrange(year_announce) %>% | |
count(year_announce) | |
growth <- tibble(year_announce = 1830:2019) %>% | |
left_join(growth) %>% | |
replace_na(list(n=0)) %>% | |
mutate(cum = cumsum(n)) | |
temple <- magick::image_read("https://d3ewd3ysu1dfsj.cloudfront.net/images/stories/large/35030.jpg?1487202042") %>% | |
image_border(color = "black") %>% | |
as.raster() | |
y_lines <- tibble(x.end = c(1912, 1952, 1980, 1990, 2000, 2019), x = -Inf, y = c(6, 12, 25, 50, 100, 200)) | |
growth %>% | |
ggplot(aes(x = year_announce, y = cum)) + | |
geom_segment(data = y_lines, aes(x = x, y = y, yend = y, xend = x.end), color = "darkgrey") + | |
geom_col(color = "white", fill = "black", size = .1) + | |
coord_cartesian(x = c(1910, 2019)) + | |
scale_y_continuous(breaks = y_lines$y) + | |
scale_x_continuous(breaks = y_lines$x.end) + | |
theme_bw() + | |
theme(panel.grid.minor = element_blank(), panel.grid.major = element_blank()) + | |
labs(x = "Year (Doubling time ~25 years)", y = "Number of temples built or announced", title = "Exponential growth of temple announcements", | |
subtitle = "The Church of Jesus Christ of Latter-day Saints") + | |
annotate("text", x = 1935, y = 175, label = "This is not the only temple we shall build; there will be hundreds of them built and dedicated to the Lord.\nThis temple will be known as the first temple built in the mountains by the Latter-day Saints.\n - Discourses of Brigham Young, p.395 -", hjust = 0, vjust = 1) + | |
annotation_raster(temple, 1910, 1930, 130, 190) | |
ggsave("exponential_growth_temples.png", width = 12, height = 8) |
Author
hathawayj
commented
Apr 5, 2020
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment