-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy paththeme.r
More file actions
79 lines (76 loc) · 2.37 KB
/
theme.r
File metadata and controls
79 lines (76 loc) · 2.37 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
plot_ff <- "Roboto Condensed"
theme_clean <- function(
font_size = 12,
font_family = plot_ff,
center_axis_labels = FALSE) {
if (center_axis_labels) {
haxis_just_x <- 0.5
vaxis_just_y <- 0.5
v_rotation_x <- 0
v_rotation_y <- 0
} else {
haxis_just_x <- 0
vaxis_just_y <- 1
v_rotation_x <- 0
v_rotation_y <- 0
}
ggplot2::theme(
text = ggplot2::element_text(
family = font_family,
face = "plain",
color = "gray30",
size = font_size,
hjust = 0.5,
vjust = 0.5,
angle = 0,
lineheight = 0.9,
margin = ggplot2::margin(),
debug = FALSE
),
axis.title.x = ggplot2::element_text(
hjust = haxis_just_x,
angle = v_rotation_x,
size = 1.2 * font_size,
face = "bold"
),
axis.title.y = ggplot2::element_text(
vjust = vaxis_just_y,
hjust = 0,
angle = v_rotation_y,
size = 1.2 * font_size,
family = font_family,
face = "bold",
),
axis.ticks = ggplot2::element_line(color = "gray30"),
title = ggplot2::element_text(
color = "gray30",
size = font_size * 1.25,
margin = margin(b = font_size * 0.3),
family = font_family,
face = "bold",
),
plot.subtitle = ggplot2::element_text(
color = "gray30",
size = font_size * 1,
hjust = 0,
family = font_family,
face = "bold",
),
plot.caption = ggplot2::element_text(
color = "gray30",
size = font_size * .8,
hjust = 0,
family = font_family,
face = "bold",
),
legend.position = "bottom",
legend.key = ggplot2::element_rect(fill = "transparent", color = NA),
legend.background = ggplot2::element_rect(fill = "transparent", color = NA),
legend.title = ggplot2::element_blank(),
panel.background = ggplot2::element_blank(),
panel.grid.major = ggplot2::element_line(color = "gray95"),
strip.background = ggplot2::element_blank(),
plot.background = ggplot2::element_rect(fill = "transparent", color = NA),
dpi = 300,
)
}