-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathsticker.R
36 lines (28 loc) · 995 Bytes
/
sticker.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
## code to prepare `sticker` dataset goes here
sysfonts::font_add_google("Nunito")
showtext::showtext_auto()
imgurl <- file.path("data-raw", "noun-eye-7147281.png")
img <- png::readPNG(imgurl)
img_grob <- grid::rasterGrob(img, interpolate = TRUE)
sine_wave <- ggplot2::ggplot(data = data.frame(
x = seq(0, 4 * pi, length.out = 500)
), ggplot2::aes(x = x)) +
ggplot2::geom_line(ggplot2::aes(y = sin(x / 2)),
size = 4, linetype = 1,
color = "white", alpha = 0
) +
ggplot2::theme_void() +
ggimage::theme_transparent()
combined_plot <- cowplot::ggdraw() +
cowplot::draw_plot(sine_wave, 0, 0.75, 1, 1, scale = 4) +
cowplot::draw_grob(img_grob, 0, -0.1, 1, 1, 2.75)
sticker <- hexSticker::sticker(
combined_plot,
package = "EYERIS",
h_fill = "#820000", h_color = "#820000",
s_x = 1, s_y = 1.28, s_width = 0.35,
p_x = 1, p_y = 0.78, p_size = 22, p_family = "Nunito",
filename = "inst/figures/sticker.png"
)
sticker
usethis::use_data(sticker, overwrite = TRUE)