-
Notifications
You must be signed in to change notification settings - Fork 2
/
logo_for_hexmake.R
173 lines (158 loc) · 5.94 KB
/
logo_for_hexmake.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
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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
library(tidyverse)
## notes on hex config on hexmake
## name x pos: 1, name y pos: 1.4,
## sans, size 8
## image x:1 y: 0.67
## width 0.82, height 0.82
## hex fill color: 3rd purple from top
## hex border color: 3rd purple from bottom
data <- tibble(x= 1:100, y= 1:100)
data %>%
ggplot(aes(x, y)) +
scale_x_continuous(minor_breaks = seq(10, 100, 10)) +
scale_y_continuous(minor_breaks = seq(10, 100, 10)) +
theme_linedraw() +
# fill transparent, color NA at end
theme(panel.background = element_rect(fill = "purple1",
colour = "purple1"))->
p
p
p +
geom_rect(xmin = 32, xmax=68, ymin=94, ymax=100, color='white',
size=0.5, fill = "transparent") +
annotate('text', x= 50, y=97, color = "white",
label= 'NNN Patients assessed for eligibility', size=2.5) ->
p
p +
geom_rect(xmin = 31, xmax=69, ymin=73, ymax=83, color='white',
fill='transparent', size=0.5) +
annotate('text', x= 50, y=78, color = "white",
label= 'NNN Patients randomly assigned\n and included in the intention-to-treat analysis', size=2.3) +
geom_rect(xmin = 70, xmax=100, ymin=80, ymax=97, color='white',
fill='transparent', size=0.5) +
annotate('text', x= 85, y=89, color = "white",
label= 'NNN Patients excluded\n 172 Did not meet inclusion criteria\n 17 Withdrew consent\n 2 Lost to follow up', size=2.3) ->p
p
p +
geom_segment(color = "white",
x=50, xend=50, y=94, yend=83.3,
size=0.5, linejoin = "mitre", lineend = "butt",
arrow = arrow(length = unit(1, "mm"), type= "closed")) +
geom_segment(color = "white",
x=50, xend=69.7, y=89, yend=89,
size=0.5, linejoin = "mitre", lineend = "butt",
arrow = arrow(length = unit(1, "mm"), type= "closed")) ->
p
p
p +
geom_segment(color = "white",
#middle arrow first
x=50, xend=50, y=73, yend=58.3,
size=0.5, linejoin = "mitre", lineend = "butt",
arrow = arrow(length = unit(1, "mm"), type= "closed")) +
# then left arrow, x and xend=30
geom_segment(color = "white",
x=30, xend=30, y=65, yend=58.3,
size=0.5, linejoin = "mitre", lineend = "butt",
arrow = arrow(length = unit(1, "mm"), type= "closed")) +
# then right arrow, x and xend=70
geom_segment(color = "white",
x=70, xend=70, y=65, yend=58.3,
size=0.5, linejoin = "mitre", lineend = "butt",
arrow = arrow(length = unit(1, "mm"), type= "closed")) +
# then horizontal line, but remove the arrow
geom_segment( color = "white",
x=30, xend=70, y=65, yend=65,
size=0.5, linejoin = "mitre", lineend = "butt")->
p
p
p +
#Left box
geom_rect(xmin = 21, xmax=39, ymin=49, ymax=58,
color='white', fill='transparent', size=0.5) +
annotate('text', x= 30, y=54, size=2, color='white',
label= 'NN Patients assigned\nto Placebo') +
#Middle box
geom_rect(xmin = 41, xmax=59, ymin=49, ymax=58,
color='white', fill='transparent', size=0.5) +
annotate('text', x= 50, y=54, size=2, color='white',
label= 'NN Patients assigned\nto Low Dose') +
#3rd box
geom_rect(xmin = 61, xmax=79, ymin=49, ymax=58,
color='white', fill='transparent', size=0.5) +
annotate('text', x= 70, y=54, size=2, color='white',
label= 'NN Patients assigned\nto High Dose') ->
p
p
p +
#Left arrow
geom_segment(
x=22, xend=22, y=49, yend=25.3, color = "white",
size=0.5, linejoin = "mitre", lineend = "butt",
arrow = arrow(length = unit(1, "mm"), type= "closed")) +
#middle arrow
geom_segment(color = "white",
x=42, xend=42, y=49, yend=25.3,
size=0.5, linejoin = "mitre", lineend = "butt",
arrow = arrow(length = unit(1, "mm"), type= "closed")) +
#right arrow
geom_segment(color = "white",
x=62, xend=62, y=49, yend=25.3,
size=0.5, linejoin = "mitre", lineend = "butt",
arrow = arrow(length = unit(1, "mm"), type= "closed")) ->
p
p
p +
#Left box
geom_rect(xmin = 25, xmax=39, ymin=30, ymax=46,
color='white', fill='transparent', size=0.5) +
annotate('text', x= 32, y=38, size=2, color='white',
label= '1 Discontinued \n1 Adverse event\n1 Lack of efficacy') +
#Middle box
geom_rect(xmin = 45, xmax=59, ymin=30, ymax=46,
color='white', fill='transparent', size=0.5) +
annotate('text', x= 52, y=38, size=2, color='white',
label= '4 Discontinued \n2 Adverse event\n1 Lack of efficacy\n1 Other') +
#right box
geom_rect(xmin = 65, xmax=79, ymin=30, ymax=46,
color='white', fill='transparent', size=0.5) +
annotate('text', x= 72, y=38, size=2, color='white',
label= '6 Discontinued \n4 Adverse event\n1 Lack of efficacy\n1 Other') ->p
p
p +
#left arrow
geom_segment(color = "white",
x=22, xend=24.7, y=38, yend=38,
size=0.5, linejoin = "mitre", lineend = "butt",
arrow = arrow(length = unit(1, "mm"), type= "closed")) +
#middle arrow
geom_segment(color = "white",
x=42, xend=44.7, y=38, yend=38,
size=0.5, linejoin = "mitre", lineend = "butt",
arrow = arrow(length = unit(1, "mm"), type= "closed")) +
#right arrow
geom_segment(color = "white",
x=62, xend=64.7, y=38, yend=38,
size=0.5, linejoin = "mitre", lineend = "butt",
arrow = arrow(length = unit(1, "mm"), type= "closed")) -> p
p
p +
#left box
geom_rect(xmin = 21, xmax=39, ymin=17, ymax=25,
color='white', fill='transparent', size=0.5) +
annotate('text', x= 30, y=21, size=2, color='white',
label= 'NN Patients completed\nthe study') +
#middle box
geom_rect(xmin = 41, xmax=59, ymin=17, ymax=25,
color='white', fill='transparent', fill='transparent', size=0.5) +
annotate('text', x= 50, y=21, size=2, color='white',
label= 'NN Patients completed\nthe study') +
#right box
geom_rect(xmin = 61, xmax=79, ymin=17, ymax=25,
color='white', fill='transparent', size=0.5) +
annotate('text', x= 70, y=21, size=2, color='white',
label= 'NN Patients completed\nthe study') +
theme_void()->
p
p
ggsave(filename = "hexmake_logo.png", bg = "transparent")