Skip to content

Commit 05e8904

Browse files
authored
Add files via upload
1 parent 6b4a09e commit 05e8904

File tree

1 file changed

+164
-0
lines changed

1 file changed

+164
-0
lines changed

ggplot_theme_Publication-2.R

+164
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,164 @@
1+
2+
3+
theme_Publication <- function(base_size=14, base_family="sans") {
4+
library(grid)
5+
library(ggthemes)
6+
(theme_foundation(base_size=base_size, base_family=base_family)
7+
+ theme(plot.title = element_text(face = "bold",
8+
size = rel(1.2), hjust = 0.5, margin = margin(0,0,20,0)),
9+
text = element_text(),
10+
panel.background = element_rect(colour = NA),
11+
plot.background = element_rect(colour = NA),
12+
panel.border = element_rect(colour = NA),
13+
axis.title = element_text(face = "bold",size = rel(1)),
14+
axis.title.y = element_text(angle=90,vjust =2),
15+
axis.title.x = element_text(vjust = -0.2),
16+
axis.text = element_text(),
17+
axis.line.x = element_line(colour="black"),
18+
axis.line.y = element_line(colour="black"),
19+
axis.ticks = element_line(),
20+
panel.grid.major = element_line(colour="#f0f0f0"),
21+
panel.grid.minor = element_blank(),
22+
legend.key = element_rect(colour = NA),
23+
legend.position = "bottom",
24+
legend.direction = "horizontal",
25+
legend.box = "vetical",
26+
legend.key.size= unit(0.5, "cm"),
27+
#legend.margin = unit(0, "cm"),
28+
legend.title = element_text(face="italic"),
29+
plot.margin=unit(c(10,5,5,5),"mm"),
30+
strip.background=element_rect(colour="#f0f0f0",fill="#f0f0f0"),
31+
strip.text = element_text(face="bold")
32+
))
33+
34+
}
35+
36+
scale_fill_Publication <- function(...){
37+
library(scales)
38+
discrete_scale("fill","Publication",manual_pal(values = c("#386cb0","#f87f01","#7fc97f","#ef3b2c","#feca01","#a6cee3","#fb9a99","#984ea3","#8C591D")), ...)
39+
40+
}
41+
42+
scale_colour_Publication <- function(...){
43+
library(scales)
44+
discrete_scale("colour","Publication",manual_pal(values = c("#386cb0","#f87f01","#7fc97f","#ef3b2c","#feca01","#a6cee3","#fb9a99","#984ea3","#8C591D")), ...)
45+
46+
}
47+
48+
49+
### Dark theme for ggplot plots
50+
51+
theme_dark_grey <- function(base_size=14, base_family="sans") {
52+
library(grid)
53+
library(ggthemes)
54+
(theme_foundation(base_size=base_size, base_family=base_family)
55+
+ theme(plot.title = element_text(face = "bold", colour = '#ffffb3',
56+
size = rel(1.2), hjust = 0.5, margin = margin(0,0,20,0)),
57+
text = element_text(),
58+
panel.background = element_rect(colour = NA, fill = 'grey20'),
59+
plot.background = element_rect(colour = NA, fill = '#262626'),
60+
panel.border = element_rect(colour = NA),
61+
axis.title = element_text(face = "bold",size = rel(1), colour = 'white'),
62+
axis.title.y = element_text(angle=90,vjust =2),
63+
axis.title.x = element_text(vjust = -0.2),
64+
axis.text = element_text(colour = 'grey70'),
65+
axis.line.x = element_line(colour="grey70"),
66+
axis.line.y = element_line(colour="grey70"),
67+
axis.ticks = element_line(colour="grey70"),
68+
panel.grid.major = element_line(colour="#262626"),
69+
panel.grid.minor = element_blank(),
70+
legend.background = element_rect(fill ='#262626'),
71+
legend.text = element_text(color = 'white'),
72+
legend.key = element_rect(colour = NA, fill = '#262626'),
73+
legend.position = "bottom",
74+
legend.direction = "horizontal",
75+
legend.box = "vetical",
76+
legend.key.size= unit(0.5, "cm"),
77+
#legend.margin = unit(0, "cm"),
78+
legend.title = element_text(face="italic", colour = 'white'),
79+
plot.margin=unit(c(10,5,5,5),"mm"),
80+
strip.background=element_rect(colour="#2D3A4C",fill="#2D3A4C"),
81+
strip.text = element_text(face="bold", colour = 'white')
82+
))
83+
}
84+
85+
scale_fill_Publication_dark <- function(...){
86+
library(scales)
87+
discrete_scale("fill","Publication",manual_pal(values = c("#fbb4ae","#b3cde3","#ccebc5","#decbe4","#fed9a6","#ffffcc","#e5d8bd","#fddaec","#f2f2f2")), ...)
88+
89+
}
90+
91+
scale_colour_Publication_dark <- function(...){
92+
library(scales)
93+
discrete_scale("colour","Publication",manual_pal(values = c("#fbb4ae","#b3cde3","#ccebc5","#decbe4","#fed9a6","#ffffcc","#e5d8bd","#fddaec","#f2f2f2")), ...)
94+
95+
}
96+
97+
98+
# theme_transparent <- function(base_size=14, base_family="sans") {
99+
# library(grid)
100+
# library(ggthemes)
101+
# (theme_foundation(base_size=base_size, base_family=base_family)
102+
# + theme(plot.title = element_text(face = "bold", colour = '#ffffb3',
103+
# size = rel(1.2), hjust = 0.5),
104+
# text = element_text(),
105+
# panel.background = element_rect(colour = NA, fill = 'transparent'),
106+
# plot.background = element_rect(colour = NA, fill = 'transparent'),
107+
# panel.border = element_rect(colour = NA),
108+
# axis.title = element_text(face = "bold",size = rel(1), colour = 'white'),
109+
# axis.title.y = element_text(angle=90,vjust =2),
110+
# axis.title.x = element_text(vjust = -0.2),
111+
# axis.text = element_text(colour = 'grey70'),
112+
# axis.line.x = element_line(colour="grey70"),
113+
# axis.line.y = element_line(colour="grey70"),
114+
# axis.ticks = element_line(colour="grey70"),
115+
# panel.grid.major = element_line(colour="#262626"),
116+
# panel.grid.minor = element_blank(),
117+
# legend.background = element_rect(fill = 'transparent'),
118+
# legend.text = element_text(color = 'white'),
119+
# legend.key = element_rect(colour = NA, fill = 'grey20'),
120+
# legend.position = "bottom",
121+
# legend.direction = "horizontal",
122+
# legend.box = "vetical",
123+
# legend.key.size= unit(0.5, "cm"),
124+
# #legend.margin = unit(0, "cm"),
125+
# legend.title = element_text(face="italic", colour = 'white'),
126+
# plot.margin=unit(c(10,5,5,5),"mm"),
127+
# strip.background=element_rect(colour="#2D3A4C",fill="#2D3A4C"),
128+
# strip.text = element_text(face="bold", colour = 'white')
129+
# ))
130+
# }
131+
132+
theme_dark_blue <- function(base_size=14, base_family="sans") {
133+
library(grid)
134+
library(ggthemes)
135+
(theme_foundation(base_size=base_size, base_family=base_family)
136+
+ theme(plot.title = element_text(face = "bold", colour = '#ffffb3',
137+
size = rel(1.2), hjust = 0.5, margin = margin(0,0,20,0)),
138+
text = element_text(),
139+
panel.background = element_rect(colour = NA, fill = '#282C33'),
140+
plot.background = element_rect(colour = NA, fill = '#282C33'),
141+
panel.border = element_rect(colour = NA),
142+
axis.title = element_text(face = "bold",size = rel(1), colour = 'white'),
143+
axis.title.y = element_text(angle=90,vjust =2),
144+
axis.title.x = element_text(vjust = -0.2),
145+
axis.text = element_text(colour = 'grey70'),
146+
axis.line.x = element_line(colour="grey70"),
147+
axis.line.y = element_line(colour="grey70"),
148+
axis.ticks = element_line(colour="grey70"),
149+
panel.grid.major = element_line(colour="#343840"),
150+
panel.grid.minor = element_blank(),
151+
legend.background = element_rect(fill ='#282C33'),
152+
legend.text = element_text(color = 'white'),
153+
legend.key = element_rect(colour = NA, fill = '#282C33'),
154+
legend.position = "bottom",
155+
legend.direction = "horizontal",
156+
legend.box = "vetical",
157+
legend.key.size= unit(0.5, "cm"),
158+
#legend.margin = unit(0, "cm"),
159+
legend.title = element_text(face="italic", colour = 'white'),
160+
plot.margin=unit(c(10,5,5,5),"mm"),
161+
strip.background=element_rect(colour="#2D3A4C",fill="#2D3A4C"),
162+
strip.text = element_text(face="bold", colour = 'white')
163+
))
164+
}

0 commit comments

Comments
 (0)