# ***** Load packages *****
ggplot2 |> library()
ggforce |> library() # for geom_circle
ggstar |> library() # for geom_star
# ***** Set the coordinates for a magnifying len *****
# Prepare a data frame for a circle/glass
circle <- data.frame(
x = 50, # x coordinate
y = 50, # y coordinate
r = 40 # radius
)
# Prepare a data frame for a line (i.e. the handle of magnifying len)
line <- data.frame(
x = c(73, 90),
y = c(20, 0)
)
# Prepare a data frame for the text "Happy New Year"
text <- data.frame(
x = c(50, 50, 50),
y = c(70, 50, 30),
label = c("Happy", "New", "Year")
)
# Prepare a data frame for two stars (left and right)
stars <- data.frame(
x = c(22, 78),
y = c(50, 50)
)
# ***** Plot *****
df <- data.frame(
x = seq(1, 100),
y = seq(1, 100)
)
happy_new_year <- df |>
ggplot(aes(x = x, y = y)) +
geom_point(alpha = 0) +
geom_line(
data = line,
aes(x = x, y = y),
linewidth = 4,
color = "black"
) +
ggforce::geom_circle(
data = circle,
aes(x0 = x, y0 = y, r = r, linewidth = 8),
color = "#3674C1"
) +
geom_text(
data = text,
aes(x = x, y = y, label = label),
size = 4.2,
color = "red",
fontface = "italic"
) +
ggstar::geom_star(
data = stars,
aes(x = x, y = y, ),
starshape = 14,
size = 2.5,
color = "gold",
fill = "gold"
) +
theme_void() +
theme(
legend.position = "none"
)
happy_new_year |> ggsave(
filename = "images/happy_new_year.png",
width = 3,
height = 3,
units = "cm",
dpi = 300
)