Skip to content

Commit 951e5b6

Browse files
committed
projection and recentering 🌋
1 parent c4ac93c commit 951e5b6

File tree

2 files changed

+14
-7
lines changed

2 files changed

+14
-7
lines changed

plots/plot_2020-05-12.png

-147 KB
Loading

scripts/script_2020-05-12.R

+14-7
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,18 @@ volcano_sf <-
1919
NA_character_, last_eruption_year),
2020
last_eruption_year = as.numeric(last_eruption_year)) %>%
2121
st_as_sf(coords = c("longitude", "latitude")) %>%
22-
st_set_crs(4326)
22+
st_set_crs(4326) %>%
23+
st_transform("+proj=eqearth +wktext")
24+
25+
world_proj <-
26+
world %>%
27+
st_as_sf() %>%
28+
st_transform("+proj=eqearth +wktext")
2329

2430
world_hex <-
25-
world %>%
31+
world_proj %>%
2632
st_make_grid(what = "polygons", square = FALSE,
27-
n = c(400, 200)) %>%
33+
n = c(400, 200)) %>% # soooo long
2834
st_sf() %>%
2935
mutate(id_hex = 1:n()) %>%
3036
select(id_hex, geometry)
@@ -46,7 +52,8 @@ world_point <-
4652
mutate(volcano = case_when(is.na(recent_eruption) ~ "no",
4753
recent_eruption ~ "recent",
4854
TRUE ~ "old")) %>%
49-
st_centroid()
55+
st_centroid() %>%
56+
st_transform("+proj=eqearth +wktext +lon_0=-105")
5057

5158

5259
#### Plots ####
@@ -56,7 +63,7 @@ font <- "Volcanic Dungeon"
5663
ggplot(world_point) +
5764
geom_sf(aes(color = volcano), size = 0.01) +
5865
scale_color_manual(values = c("no" = "#4C453A", "recent" = "#EC5E29", "old" = "#D6FC79")) +
59-
annotate(geom = "text", x = 190, y = -100, family = font, size = 3,
66+
annotate(geom = "text", x = 17000000, y = -9500000, family = font, size = 3,
6067
color = "#E3E2CE", hjust = 1.06, lineheight = 1.7,
6168
label = "Source: The Smithsonian Institution\n@_abichat for #TidyTuesday ") +
6269
labs(title = "Volcanoes around the world",
@@ -67,7 +74,7 @@ ggplot(world_point) +
6774
plot.title = element_markdown(color = "#E3E2CE", hjust = 0.5, size = 20, family = font),
6875
plot.subtitle = element_markdown(color = "#E3E2CE", hjust = 0.5, size = 12, family = font),
6976
panel.grid = element_blank(),
70-
plot.margin = margin(10, -45, 5, -25),
77+
plot.margin = margin(10, -25, 5, -25),
7178
plot.background = element_rect(fill = "black"))
7279

73-
ggsave("plots/plot_2020-05-12.png", width = 29, height = 18.7, units = "cm", dpi = "retina")
80+
ggsave("plots/plot_2020-05-12.png", width = 29, height = 18.98, units = "cm", dpi = "retina")

0 commit comments

Comments
 (0)