forked from koundy/ggplot_theme_Publication
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathggplot_theme_Publication-2.R
164 lines (147 loc) · 8 KB
/
ggplot_theme_Publication-2.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
theme_Publication <- function(base_size=14, base_family="sans") {
library(grid)
library(ggthemes)
(theme_foundation(base_size=base_size, base_family=base_family)
+ theme(plot.title = element_text(face = "bold",
size = rel(1.2), hjust = 0.5, margin = margin(0,0,20,0)),
text = element_text(),
panel.background = element_rect(colour = NA),
plot.background = element_rect(colour = NA),
panel.border = element_rect(colour = NA),
axis.title = element_text(face = "bold",size = rel(1)),
axis.title.y = element_text(angle=90,vjust =2),
axis.title.x = element_text(vjust = -0.2),
axis.text = element_text(),
axis.line.x = element_line(colour="black"),
axis.line.y = element_line(colour="black"),
axis.ticks = element_line(),
panel.grid.major = element_line(colour="#f0f0f0"),
panel.grid.minor = element_blank(),
legend.key = element_rect(colour = NA),
legend.position = "bottom",
legend.direction = "horizontal",
legend.box = "vetical",
legend.key.size= unit(0.5, "cm"),
#legend.margin = unit(0, "cm"),
legend.title = element_text(face="italic"),
plot.margin=unit(c(10,5,5,5),"mm"),
strip.background=element_rect(colour="#f0f0f0",fill="#f0f0f0"),
strip.text = element_text(face="bold")
))
}
scale_fill_Publication <- function(...){
library(scales)
discrete_scale("fill","Publication",manual_pal(values = c("#386cb0","#f87f01","#7fc97f","#ef3b2c","#feca01","#a6cee3","#fb9a99","#984ea3","#8C591D")), ...)
}
scale_colour_Publication <- function(...){
library(scales)
discrete_scale("colour","Publication",manual_pal(values = c("#386cb0","#f87f01","#7fc97f","#ef3b2c","#feca01","#a6cee3","#fb9a99","#984ea3","#8C591D")), ...)
}
### Dark theme for ggplot plots
theme_dark_grey <- function(base_size=14, base_family="sans") {
library(grid)
library(ggthemes)
(theme_foundation(base_size=base_size, base_family=base_family)
+ theme(plot.title = element_text(face = "bold", colour = '#ffffb3',
size = rel(1.2), hjust = 0.5, margin = margin(0,0,20,0)),
text = element_text(),
panel.background = element_rect(colour = NA, fill = 'grey20'),
plot.background = element_rect(colour = NA, fill = '#262626'),
panel.border = element_rect(colour = NA),
axis.title = element_text(face = "bold",size = rel(1), colour = 'white'),
axis.title.y = element_text(angle=90,vjust =2),
axis.title.x = element_text(vjust = -0.2),
axis.text = element_text(colour = 'grey70'),
axis.line.x = element_line(colour="grey70"),
axis.line.y = element_line(colour="grey70"),
axis.ticks = element_line(colour="grey70"),
panel.grid.major = element_line(colour="#262626"),
panel.grid.minor = element_blank(),
legend.background = element_rect(fill ='#262626'),
legend.text = element_text(color = 'white'),
legend.key = element_rect(colour = NA, fill = '#262626'),
legend.position = "bottom",
legend.direction = "horizontal",
legend.box = "vetical",
legend.key.size= unit(0.5, "cm"),
#legend.margin = unit(0, "cm"),
legend.title = element_text(face="italic", colour = 'white'),
plot.margin=unit(c(10,5,5,5),"mm"),
strip.background=element_rect(colour="#2D3A4C",fill="#2D3A4C"),
strip.text = element_text(face="bold", colour = 'white')
))
}
scale_fill_Publication_dark <- function(...){
library(scales)
discrete_scale("fill","Publication",manual_pal(values = c("#fbb4ae","#b3cde3","#ccebc5","#decbe4","#fed9a6","#ffffcc","#e5d8bd","#fddaec","#f2f2f2")), ...)
}
scale_colour_Publication_dark <- function(...){
library(scales)
discrete_scale("colour","Publication",manual_pal(values = c("#fbb4ae","#b3cde3","#ccebc5","#decbe4","#fed9a6","#ffffcc","#e5d8bd","#fddaec","#f2f2f2")), ...)
}
# theme_transparent <- function(base_size=14, base_family="sans") {
# library(grid)
# library(ggthemes)
# (theme_foundation(base_size=base_size, base_family=base_family)
# + theme(plot.title = element_text(face = "bold", colour = '#ffffb3',
# size = rel(1.2), hjust = 0.5),
# text = element_text(),
# panel.background = element_rect(colour = NA, fill = 'transparent'),
# plot.background = element_rect(colour = NA, fill = 'transparent'),
# panel.border = element_rect(colour = NA),
# axis.title = element_text(face = "bold",size = rel(1), colour = 'white'),
# axis.title.y = element_text(angle=90,vjust =2),
# axis.title.x = element_text(vjust = -0.2),
# axis.text = element_text(colour = 'grey70'),
# axis.line.x = element_line(colour="grey70"),
# axis.line.y = element_line(colour="grey70"),
# axis.ticks = element_line(colour="grey70"),
# panel.grid.major = element_line(colour="#262626"),
# panel.grid.minor = element_blank(),
# legend.background = element_rect(fill = 'transparent'),
# legend.text = element_text(color = 'white'),
# legend.key = element_rect(colour = NA, fill = 'grey20'),
# legend.position = "bottom",
# legend.direction = "horizontal",
# legend.box = "vetical",
# legend.key.size= unit(0.5, "cm"),
# #legend.margin = unit(0, "cm"),
# legend.title = element_text(face="italic", colour = 'white'),
# plot.margin=unit(c(10,5,5,5),"mm"),
# strip.background=element_rect(colour="#2D3A4C",fill="#2D3A4C"),
# strip.text = element_text(face="bold", colour = 'white')
# ))
# }
theme_dark_blue <- function(base_size=14, base_family="sans") {
library(grid)
library(ggthemes)
(theme_foundation(base_size=base_size, base_family=base_family)
+ theme(plot.title = element_text(face = "bold", colour = '#ffffb3',
size = rel(1.2), hjust = 0.5, margin = margin(0,0,20,0)),
text = element_text(),
panel.background = element_rect(colour = NA, fill = '#282C33'),
plot.background = element_rect(colour = NA, fill = '#282C33'),
panel.border = element_rect(colour = NA),
axis.title = element_text(face = "bold",size = rel(1), colour = 'white'),
axis.title.y = element_text(angle=90,vjust =2),
axis.title.x = element_text(vjust = -0.2),
axis.text = element_text(colour = 'grey70'),
axis.line.x = element_line(colour="grey70"),
axis.line.y = element_line(colour="grey70"),
axis.ticks = element_line(colour="grey70"),
panel.grid.major = element_line(colour="#343840"),
panel.grid.minor = element_blank(),
legend.background = element_rect(fill ='#282C33'),
legend.text = element_text(color = 'white'),
legend.key = element_rect(colour = NA, fill = '#282C33'),
legend.position = "bottom",
legend.direction = "horizontal",
legend.box = "vetical",
legend.key.size= unit(0.5, "cm"),
#legend.margin = unit(0, "cm"),
legend.title = element_text(face="italic", colour = 'white'),
plot.margin=unit(c(10,5,5,5),"mm"),
strip.background=element_rect(colour="#2D3A4C",fill="#2D3A4C"),
strip.text = element_text(face="bold", colour = 'white')
))
}