forked from tidy-finance/website
-
Notifications
You must be signed in to change notification settings - Fork 0
/
pre_render_script.R
51 lines (46 loc) · 957 Bytes
/
pre_render_script.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
Sys.setlocale("LC_TIME", "English")
Sys.setenv(LANG = "en")
options(
tibble.print_max = 5,
tibble.print_min = 5,
tibble.width = 69,
htmltools.dir.version = FALSE,
formatR.indent = 2,
digits = 3,
width = 69,
crayon.enabled = FALSE
)
# ggplot2 global theme
library(ggplot2)
theme_set(theme_bw() + theme(legend.position = "bottom"))
pal <- grDevices::colorRampPalette(list(
"#3B9AB2",
"#78B7C5",
"#EBCC2A",
"#E1AF00",
"#F21A00"
))
scale_colour_continuous <- function(...) {
scale_color_gradientn(
colours = pal(256),
...
)
}
scale_colour_discrete <- function(...) {
discrete_scale("colour",
scale_name = "pal",
palette = pal, ...
)
}
scale_fill_continuous <- function(...) {
scale_fill_gradientn(
colours = pal(256),
...
)
}
scale_fill_discrete <- function(...) {
discrete_scale("fill",
scale_name = "pal",
palette = pal, ...
)
}