-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path2026-01-02_happy-new-year.qmd
More file actions
96 lines (86 loc) · 1.86 KB
/
2026-01-02_happy-new-year.qmd
File metadata and controls
96 lines (86 loc) · 1.86 KB
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
---
title: Happy New Year
date: 2026-01-02
toc-depth: 4
toc-expand: true
lang: en
---
<center>
{width="60%"}
</center>
```{r}
#| eval: false
# ***** 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
)
```
[给我买杯茶🍵](给我买杯茶.qmd)