Created
August 6, 2019 00:33
-
-
Save karawoo/ddef4ca9a4294322fa0ee7fa8b3b5526 to your computer and use it in GitHub Desktop.
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
library("cholera") | |
library("tidyverse") | |
library("magick") | |
library("grid") | |
library("egg") | |
# Get image | |
bree <- image_read("https://pbs.twimg.com/media/EBPHuylUIAAziJt?format=jpg") | |
# Add x/y coordinates of Broad St. pump and convert format | |
image_data <- filter(pumps.vestry, street == "Broad Street") %>% | |
select(x, y) %>% | |
mutate(image = list(rasterGrob(bree, width = unit(0.05, "npc")))) | |
# Plot | |
ggplot(mapping = aes(x = x, y = y)) + | |
geom_path(data = roads, aes(group = street), color = "gray") + | |
geom_point(data = fatalities) + | |
geom_point(data = pumps.vestry, color = "blue", stroke = 0.75) + | |
geom_custom(data = image_data, aes(data = image), grob_fun = identity) + | |
ggsave("geom_bree.png") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment