/
ecoevomatics_logo.R
77 lines (59 loc) · 2.32 KB
/
ecoevomatics_logo.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
customText <- function(x, y, labels, let = 0,
cex = 1, col = par('fg')) {
l <- strsplit(labels, '')[[1]]
w <- sapply(l, strwidth, cex = cex)
let <- let * strwidth('m', cex = cex)
# browser()
xx <- x + cumsum(c(0, w[-length(w)] + let))
xx <- xx - mean(xx) + 1
yy <- rep(y, length(xx))
text(xx, yy, l, adj = c(0, 0.5), cex = cex, col = col)
out <- list(x0 = xx - 0.5 * let, x1 = x + cumsum(w + let) - 0.5 * let,
y0 = y - strheight(labels, cex = cex) * 1,
y1 = y + strheight(labels, cex = cex) * 1)
names(out[[1]]) <- names(out[[2]]) <- l
invisible(out)
}
let <- 0.3
cex <- 2
vlet <- 0.35
mainCol <- 'white'
backCol <- 'gray50'
# png('eem_logo.png', width = 4.3, height = 4.3, units = 'in', res = 380)
par(mar = rep(2, 4), bg = 'white')
plot(1, type = 'n', xlim = c(0, 2), ylim = c(-1, 1),
# axes = FALSE
)
s1 <- customText(0, vlet, 'ECOLOGICAL',
col = c(rep(mainCol, 3), rep(backCol, 7)),
let = let, cex = cex)
s2 <- customText(0, 0, '& EVOLUTIONARY',
col = c(rep(backCol, 2), rep(mainCol, 3), rep(backCol, 9)),
let = let, cex = cex)
s3 <- customText(0, -vlet, 'INFORMATICS',
col = c(rep(backCol, 5), rep(mainCol, 6)),
let = let, cex = cex)
rect(xleft = s1$x0[grep('E', names(s1$x0))],
xright = s1$x1[grep('O', names(s1$x1))][1],
ybottom = s1$y0, ytop = s1$y1,
border = mainCol, col = 'black')
rect(xleft = s2$x0[grep('E', names(s2$x0))],
xright = s2$x1[grep('O', names(s2$x1))][1],
ybottom = s2$y0, ytop = s2$y1,
border = mainCol, col = 'black')
rect(xleft = s3$x0[grep('M', names(s3$x0))],
xright = s3$x1[grep('S', names(s3$x1))],
ybottom = s3$y0, ytop = s3$y1,
border = mainCol, col = 'black')
customText(0, vlet, 'ECOLOGICAL',
col = c(rep(mainCol, 3), rep(backCol, 7)),
let = let, cex = cex)
customText(0, 0, '& EVOLUTIONARY',
col = c(rep(backCol, 2), rep(mainCol, 3), rep(backCol, 9)),
let = let, cex = cex)
customText(0, -vlet, 'INFORMATICS',
col = c(rep(backCol, 5), rep(mainCol, 6)),
let = let, cex = cex)
abline(v = 1)
text(1, 0.5, labels = 'ECOLOGICAL')
# dev.off()