-
Notifications
You must be signed in to change notification settings - Fork 95
/
Copy pathmarkup.R
47 lines (37 loc) · 1.63 KB
/
markup.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
library(tidyverse)
library(magick)
library(glue)
# Load `header` list with needed data
header <- readRDS("R/portraits/washington/header.rds")
colors <- header$colors
swatchplot(colors)
text_color <- colors[1]
img <- image_read(header$outfile)
annot <- glue("This map shows population density of Washington. ",
"Population estimates are bucketed ",
"into 400 meter (about 1/4 mile) hexagons.") |>
str_wrap(45)
cat(annot)
img |>
image_crop(geometry = "7250x4000+400+0", gravity = "center") |>
image_annotate(text = "Washington Population Density", gravity = "northwest",
location = "+200+100", font = "El Messiri",
color = text_color,
size = 225, weight = 700) |>
image_annotate(text = annot, gravity = "northeast",
location = "+200+500", font = "El Messiri",
color = alpha(text_color, .75),
size = 115) |>
image_annotate(text = "Kontur Population Data (Released June 30, 2022)",
gravity = "southwest",
location = "+200+100", font = "El Messiri",
color = alpha(text_color, .5),
size = 80, weight = 700) |>
image_annotate(text = "Graphic: Spencer Schien (@MrPecners)", gravity = "southwest",
location = "+200+225", font = "El Messiri",
color = alpha(text_color, .5),
size = 80, weight = 700) |>
image_write("images/washington/titled_wa_pop.png")
image_read("images/washington/titled_wa_pop.png") |>
image_scale(geometry = "60%x") |>
image_write("tracked_graphics/titled_wa_pop_small.png")